home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / samba / SMB-info / COREP.TXT < prev    next >
Encoding:
Text File  |  1993-12-13  |  111.8 KB  |  4,458 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.                  MMMMiiiiccccrrrroooossssoooofffftttt NNNNeeeettttwwwwoooorrrrkkkkssss////OOOOppppeeeennnnNNNNEEEETTTT
  11.  
  12.                    FFFFIIIILLLLEEEE SSSSHHHHAAAARRRRIIIINNNNGGGG PPPPRRRROOOOTTTTOOOOCCCCOOOOLLLL
  13.  
  14.  
  15.                   IIIINNNNTTTTEEEELLLL PPPPaaaarrrrtttt NNNNuuuummmmbbbbeeeerrrr 111133338888444444446666
  16.  
  17.  
  18.                     DDDDooooccccuuuummmmeeeennnntttt VVVVeeeerrrrssssiiiioooonnnn 2222....0000
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.                       NNNNoooovvvveeeemmmmbbbbeeeerrrr 7777,,,, 1111999988888888
  26.  
  27.  
  28.                    Microsoft Corporation
  29.                      Intel Corporation
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  65.  
  66.  
  67.  
  68.  
  69.  
  70. File Sharing Protocol      - 2 -            November 7, 1988
  71.  
  72.  
  73. _1.  _I_n_t_r_o_d_u_c_t_i_o_n
  74.  
  75. This document describes the MSNET/PCNET file sharing  proto-
  76. col.   Systems  can use these protocols to obtain or provide
  77. remote file services in a network environment.  These proto-
  78. cols  are  designed to allow systems to transparently access
  79. files which reside  on  remote  systems.   Items  which  are
  80. mapped into the file space (such as UNIX  style "device spe-
  81. cial files") are also transparently shared by  these  proto-
  82. cols.
  83.  
  84. When two machines first come into network contact  they  may
  85. negotiate  the  use  of a higher level "Extension Protocol".
  86. For example, two MS-DOS machines would agree to use the  MS-
  87. DOS-specific  protocol  extensions.   These  extensions  can
  88. include both new messages as well as changes to  the  fields
  89. and  semantics  of  existing  messages.  The "Core/Extension
  90. Protocol" definition allows a system  to  communicate  at  a
  91. strong,  functional level with other "core" machines, and to
  92. communicate in full transparent detail to its "brother" sys-
  93. tems.   The  ability to negotiate the protocol used across a
  94. given connection is also used, in those cases where multiple
  95. versions of a protocol exist, to ensure that only compatible
  96. versions of the protocol are used.
  97.  
  98. This  document  assumes  the  existence  of,  but  does  not
  99. describe,  a  lower  level set of protocols that provide for
  100. virtual circuits and transport between clients and  servers.
  101. Further,  it  does  not discuss the mechanism used to "iden-
  102. tify" and "locate" a correspondent  in  order  to  establish
  103. said  virtual  circuit.  The details of virtual circuit sup-
  104. port for MS-DOS are described  in  the  document  "Transport
  105. Layer Interface".
  106.  
  107. _2.  _M_e_s_s_a_g_e _F_o_r_m_a_t
  108.  
  109. Every message has a common format.  The following C-language
  110. style definition shows that format.
  111.  
  112. BYTE   smb_idf[4];   /* contains 0xFF, 'SMB' */
  113. BYTE   smb_com;      /* command code */
  114. BYTE   smb_rcls;     /* error code class */
  115. BYTE   smb_reh;      /* reserved (contains AH if DOS INT-24 ERR) */
  116. WORD   smb_err;      /* error code */
  117. BYTE   smb_reb;      /* reserved */
  118. WORD   smb_res[7];   /* reserved */
  119. WORD   smb_tid;      /* tree id #  */
  120. WORD   smb_pid;      /* caller's process id # */
  121. WORD   smb_uid;      /* user id # */
  122. WORD   smb_mid;      /* mutiplex id #  */
  123. BYTE   smb_wct;      /* count of parameter words */
  124. WORD   smb_vwv[];    /* variable # words of params */
  125. WORD   smb_bcc;      /* # bytes of data following */
  126. BYTE   smb_data[];   /* data bytes */
  127.  
  128.  
  129.  
  130. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  131.  
  132.  
  133.  
  134.  
  135.  
  136. File Sharing Protocol      - 3 -            November 7, 1988
  137.  
  138.  
  139.  
  140.         A BYTE is an octet.
  141.         A WORD is two bytes.
  142.         The bytes within a word are ordered such that the low byte precedes the high byte.
  143.  
  144.  
  145. smb_com:command code.
  146.  
  147. smb_rcls:error class (see below).
  148.  
  149. smb_ret:error returned (see below).
  150.  
  151. smb_tid:Used by the server to  identify  a  sub-tree.   (see
  152.      below)
  153.  
  154. smb_pid:caller's process id.  Generated by the  consumer  to
  155.      uniquely  identify  a process within the consumers sys-
  156.      tem.
  157.  
  158. smb_mid:this field is  reserved  for  multiplexing  multiple
  159.      messages  on a single Virtual Circuit (VC).  A response
  160.      message will always  contain  the  same  value  as  the
  161.      corresponding request message.  This initial version of
  162.      the core protocol will not support multiplexing  within
  163.      a VC.  Only one request at a time may be outstanding on
  164.      any VC.
  165.  
  166. _3.  _A_r_c_h_i_t_e_c_t_u_r_a_l _M_o_d_e_l
  167.  
  168. The Network File Access system described  in  this  document
  169. deals  with two types of systems on the network -- consumers
  170. and servers.  A consumer is a system that  requests  network
  171. file services and a server is a system that delivers network
  172. file services.  Consumers and servers are logical systems; a
  173. consumer and server may coexist in a single physical system.
  174.  
  175. Consumers are responsible for directing  their  requests  to
  176. the appropriate server.  The network addressing mechanism or
  177. naming convention through which the server is identified  is
  178. outside the scope of this document.
  179.  
  180. Each server makes available to the network a  self-contained
  181. file  structure.   There are no storage or service dependen-
  182. cies on any other servers.  A file  must  be  entirely  con-
  183. tained by a single server.
  184.  
  185. The core file sharing protocol requires  server  authentica-
  186. tion of users before file accesses are allowed.  Each server
  187. processor authenticates its own users.  A user must  "login"
  188. to each server that it wishes to access.
  189.  
  190. This authentication model  assumes  that  the  LAN  connects
  191. autonomous  systems  that are willing to make some subset of
  192. their local files available to remote users.
  193.  
  194.  
  195.  
  196. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  197.  
  198.  
  199.  
  200.  
  201.  
  202. File Sharing Protocol      - 4 -            November 7, 1988
  203.  
  204.  
  205. The following environments exist in the  core  file  sharing
  206. protocol environment.
  207.  
  208. a)   Virtual Circuit Environment.  This consists of  one  VC
  209.      established  between  a consumer system and server sys-
  210.      tem.  Consumers may have only a single  request  active
  211.      on any VC at any time, i.e., a second request cannot be
  212.      initiated until the response  to  the  first  has  been
  213.      received.  A VC is formed using transport services.
  214.  
  215. b)   Logon Environment.  This is represented by  a  Tree  ID
  216.      (TID). A TID uniquely identifies a file sharing connec-
  217.      tion between a consumer and server.  It also identifies
  218.      the  scope and type of accesses allowed across the con-
  219.      nection.  With the exception of the  Tree  Connect  and
  220.      Negotiate  commands,  the  TID  field in a message must
  221.      always contain a valid TID.  There may be any number of
  222.      file sharing connections per VC.
  223.  
  224. c)   Process Environment.  This is represented by a  process
  225.      ID (PID).  A PID uniquely identifies a consumer process
  226.      within a given VC environment.
  227.  
  228. d)   File Environment.  This is represented by a File Handle
  229.      (FID).   A  FID  identifies  an open file and is unique
  230.      within a given VC environment.
  231.  
  232. When one of these environments is terminated,  all  environ-
  233. ments  contained within it will be terminated.  For example,
  234. if a VC is terminated all PIDs, TIDs and FIDs within it will
  235. be invalidated.
  236.  
  237. _3._1.  _P_r_o_c_e_s_s _M_a_n_a_g_e_m_e_n_t
  238.  
  239. How and when servers create and  destroy  processes  is,  of
  240. course,  an implementation issue and there is no requirement
  241. that this be tied in  any  way  to  the  consumer's  process
  242. management.   However,  it is necessary for the server to be
  243. aware of the consumer's  process  management  activities  as
  244. files  are accessed on behalf of consumer processes.  There-
  245. fore the file sharing protocol includes appropriate  notifi-
  246. cations.
  247.  
  248. All messages, except Negotiate, include a process  ID  (PID)
  249. to  indicate which user process initiated a request.  Consu-
  250. mers inform servers of the creation of a new process by sim-
  251. ply  introducing  a new PID into the dialogue.  Process des-
  252. truction must be explicitly indicated and the "Process Exit"
  253. command is provided for this purpose. The consumer must send
  254. a Process Exit command whenever a user process is destroyed.
  255. This  enables the server to free any resources (e.g., locks)
  256. reserved by that process as well as perform any  local  pro-
  257. cess  management  activities  that  its implementation might
  258. require.
  259.  
  260.  
  261.  
  262. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  263.  
  264.  
  265.  
  266.  
  267.  
  268. File Sharing Protocol      - 5 -            November 7, 1988
  269.  
  270.  
  271. _4.  _F_i_l_e _S_h_a_r_i_n_g _C_o_n_n_e_c_t_i_o_n_s
  272.  
  273. The networks using this file sharing protocol  will  contain
  274. not  only  multi-user  systems  with  user  based protection
  275. models, but single-user systems  that  have  no  concept  of
  276. user-ids  or permissions.  Once these machines are connected
  277. to the network, however, they are in a  multi-user  environ-
  278. ment  and  need  a  method of access control.  First, unpro-
  279. tected machines need to be able  to  provide  some  sort  of
  280. bona-fides  to other net machines which do have permissions,
  281. secondly unprotected machines  need  to  control  access  to
  282. their files by others.
  283.  
  284. This protocol defines a mechanism that enables  the  network
  285. software  to provide the protection where it is missing from
  286. the operating system, and  supports  user  based  protection
  287. where  it is provided by the operating system. The mechanism
  288. also allows machines with no concept of  user-id  to  demon-
  289. strate access authorization to machines which do have a per-
  290. mission mechanism.   Finally,  the  permission  protocol  is
  291. designed  so that it can be omitted if both machines share a
  292. common permission mechanism.
  293.  
  294. This protocol, called the "tree connection"  protocol,  does
  295. not  specify  a  user  interface.  A possible user interface
  296. will be described by way of illustration.
  297.  
  298. _4._1.  _U_n_p_r_o_t_e_c_t_e_d _S_e_r_v_e_r _M_a_c_h_i_n_e_s
  299.  
  300. The following examples apply to access  to  serving  systems
  301. which do not have a permission mechanism.
  302.  
  303. a) NET SHARE
  304.  
  305. By default (on unprotected machines)  all  network  requests
  306. are  refused  as  unauthorized.  Should a user wish to allow
  307. access to some or all of his files he offers  access  to  an
  308. arbitrary  set  of subtrees by specifying each subtree and a
  309. password.
  310.  
  311.         Examples:
  312.  
  313.         NET SHARE  \dir1  "bonzo"
  314.  
  315.      assign password "bonzo" to all files  within  directory
  316.      "dir1" and its subdirectories.
  317.  
  318.         NET SHARE  \        " "      RO
  319.  
  320.         NET SHARE  \work  "flipper"  RW
  321.  
  322.      offer read-only access to  everything  (all  files  are
  323.      within  the root directory or its subdirectories) Offer
  324.      read-write  access  to  all  files  within  the   \work
  325.  
  326.  
  327.  
  328. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  329.  
  330.  
  331.  
  332.  
  333.  
  334. File Sharing Protocol      - 6 -            November 7, 1988
  335.  
  336.  
  337.      directory and its subdirectories.
  338. b) NET USE
  339.  
  340. Other users can gain access to one or more offered  subtrees
  341. via the NET USE command.  Once the NET USE command is issued
  342. the user can access the files freely without further special
  343. requirements.
  344.  
  345.         Examples:
  346.  
  347.         1. NET USE  \\machine-name\dir1  "bonzo"
  348.  
  349.      now any pathname starting with  \\machine-name\dir1  is
  350.      valid.
  351.  
  352.         2. NET USE  \\machine-name\
  353.  
  354.         3. NET USE  \\machine-name\work  "flipper"
  355.  
  356.      Now any read request to any file  on  that  machine  is
  357.      valid.  Read-write requests only succeed to files whose
  358.      pathnames start with \\machine-name\work
  359. The requester must remember the machine-name pathname prefix
  360. combination  supplied with the NET USE request and associate
  361. it with the index value returned by the server.   Subsequent
  362. requests  using  this  index  must include only the pathname
  363. relative to the connected subtree as the server  treats  the
  364. subtree as the root directory.
  365.  
  366. When the requester has a file access request for the server,
  367. it  looks  through its list of prefixes for that machine and
  368. selects the most specific  (the  longest)  match.   It  then
  369. includes  the  index  associated  with  this  prefix  in his
  370. request along with the remainder of the pathname.
  371.  
  372. Note that one always offers a directory and all files under-
  373. neath  that  directory  are  then affected.  If a particular
  374. file is within the range of multiple offer ranges,  connect-
  375. ing to any of the offer ranges gains access to the file with
  376. the permissions specified for the offer  named  in  the  NET
  377. USE.   The server will not check for nested directories with
  378. more restrictive permissions.
  379.  
  380. _4._2.  _P_r_o_t_e_c_t_e_d _S_e_r_v_e_r _M_a_c_h_i_n_e_s
  381.  
  382. Servers with user based file protection schemes will  inter-
  383. pret the Tree Connect command slightly differently from sys-
  384. tems with  file  oriented  file  protection  schemes.   They
  385. interpret  the  "name" parameter as a username rather than a
  386. pathname.  When this request is received,  the  username  is
  387. validated and a TID representing that authenticated instance
  388. of the user is returned.  This TID must be included  in  all
  389. further requests made on behalf of the user.
  390.  
  391.  
  392.  
  393.  
  394. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  395.  
  396.  
  397.  
  398.  
  399.  
  400. File Sharing Protocol      - 7 -            November 7, 1988
  401.  
  402.  
  403. The permission-based system need not  execute  a  NET  SHARE
  404. command;  instead  it  sets  up  name/password (or whatever)
  405. information in its user  definition  files.   The  accessing
  406. user would type
  407.  
  408.         NET USE  \\machine-name\account-name  <password>
  409.  
  410. and thereby "login" to the serving  machine.   He  need  not
  411. specify   subtrees   and   so  forth  because  the  account-
  412. name/password pair establishes access permissions to  every-
  413. thing on that machine.
  414.  
  415. This variation of Tree Connect  is  an  aspect  of  the  the
  416. server's  file  system.   Servers with user based protection
  417. schemes will always interpret the name  supplied  with  Tree
  418. Connect  as  a user name.  Users of Tree Connect simply pro-
  419. vide a "name" and its associated  "password";  they  do  not
  420. need  to  be  aware  of  the server's interpretation of that
  421. name.  If the name and password are  successfully  authenti-
  422. cated  the  caller  receives access to the set of files pro-
  423. tected by the name in the modes allowed by the server  (also
  424. determined by the name/password pair).
  425.  
  426. _4._3.  _C_o_n_n_e_c_t_i_o_n _P_r_o_t_o_c_o_l_s
  427.  
  428. The NET SHARE command generates no  network  messages.   The
  429. server  package  remembers the pathname prefix and the pass-
  430. word.
  431.  
  432. The NET USE  command  generates  a  message  containing  the
  433. path/username  and  the password.  The serving machine veri-
  434. fies the combination and returns an error code or  an  iden-
  435. tifier.   The  full  name  (path or user) is included in the
  436. Tree Connect request message and the identifier  identifying
  437. the  connection is returned in the smb_tid field.  The mean-
  438. ing of this identifier (tid) is server specific; the reques-
  439. ter must not associate any specific meaning to it.
  440.  
  441. The server makes whatever use of the tid field  it  desires.
  442. Normally it is an index into a server table which allows the
  443. server to optimize its response.
  444.  
  445. _4._4.  _T_r_e_e _C_o_n_n_e_c_t
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  461.  
  462.  
  463.  
  464.  
  465.  
  466. File Sharing Protocol      - 8 -            November 7, 1988
  467.  
  468.  
  469.   ________________________________________________________
  470.    >From Consumer              To Consumer
  471.   ________________________________________________________
  472.    smb_com     SMBtcon         smb_com      SMBtcon
  473.    smb_wct     0               smb_wct      2
  474.    smb_bcc     min=4           smb_vwv[0]   max xmit size
  475.    smb_buf[]   ASCII -- 04     smb_vwv[1]   TID
  476.                path/username   smb_bcc      0
  477.                ASCII -- 04
  478.                password
  479.                ASCII -- 04
  480.                dev name
  481.   ________________________________________________________
  482.   |||||||||||
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.                              |||||||||||
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.                                                           |||||||||||
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514. The device name is either  <device>:  for  block  device  or
  515. LPT1: for a character device.
  516.  
  517. The path/username must be specified from  the  network  root
  518. (including  \\).   The  TID  field in the request message is
  519. ignored by the server.  The maximum transmit size  field  in
  520. the response message indicates the maximum size message that
  521. the server can handle.  The  consumer  should  not  generate
  522. messages, nor expect to receive responses, larger than this.
  523. This should be constant for a given server.
  524.  
  525. Tree Connects must be issued for all subtrees accessed, even
  526. if they contain a null password.
  527.  
  528. Tree Connect may generate the following errors:
  529.  
  530.         Error Class ERRDOS:
  531.  
  532.           <implementation specific>
  533.  
  534.  
  535.         Error Class ERRSRV:
  536.  
  537.           ERRerror
  538.           ERRbadpw
  539.           ERRinvnetname
  540.           <implementation specific>
  541.  
  542.  
  543.         Error Class ERRHRD:
  544.  
  545.           <implementation specific>
  546.  
  547.  
  548. _4._5.  _T_r_e_e _D_i_s_c_o_n_n_e_c_t
  549.  
  550.  
  551.           _______________________________________
  552.            >From Consumer      To Consumer
  553.           _______________________________________
  554.            smb_com   SMBtdis   smb_com   SMBtdis
  555.            smb_wct   0         smb_wct   0
  556.            smb_bcc   0         smb_bcc   0
  557.  
  558.  
  559. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  560.  
  561.  
  562.  
  563.  
  564.  
  565. File Sharing Protocol      - 9 -            November 7, 1988
  566.  
  567.  
  568.           _______________________________________
  569.           |
  570.                              |
  571.                                                  |
  572.  
  573. The file sharing connection identified by the TID  is  logi-
  574. cally disconnected from the server.  The TID will be invali-
  575. dated; it will not be recognized if used by the consumer for
  576. subsequent requests.
  577.  
  578. Tree Disconnect may generate the following errors:
  579.  
  580.         Error Class ERRDOS:
  581.  
  582.           <implementation specific>
  583.  
  584.  
  585.         Error Class ERRSRV:
  586.  
  587.           ERRinvnid
  588.           <implementation specific>
  589.  
  590.  
  591.         Error Class ERRHRD:
  592.  
  593.           <implementation specific>
  594.  
  595.  
  596. _5.  _F_i_l_e _S_h_a_r_i_n_g _C_o_m_m_a_n_d_s
  597.  
  598. The message definitions in this section indicate the command
  599. code and include the balance of the definition commencing at
  600. the field smb_wct.   The  omitted  fields  (smb_cls  through
  601. smb_mid)  are  constant in the format and meaning defined in
  602. Section 1.0.  When an error  is  encountered  a  server  may
  603. return  only  the  header  portion  of  the  response (i.e.,
  604. smb_wct and smb_bcc both contain zero).   The  data  objects
  605. used by these commands are described in section 6.0.
  606.  
  607. The use of commands other than those defined in this section
  608. will have undefined results.
  609.  
  610. _5._1.  _O_p_e_n _F_i_l_e
  611.  
  612.  
  613.  __________________________________________________________
  614.   >From Consumer               To Consumer
  615.  __________________________________________________________
  616.   smb_com      SMBopen         smb_com      SMBopen
  617.   smb_wct      2               smb_wct      7
  618.   smb_vwv[0]   r/w/share       smb_vwv[0]   file handle
  619.   smb_vwv[1]   attribute       smb_vwv[1]   attribute
  620.   smb_bcc      min = 2         smb_vwv[2]   time1 low
  621.   smb_buf[]    ASCII -- 04     smb_vwv[3]   time1 high
  622.                file pathname   smb_vwv[4]   file size low
  623.                                smb_vwv[5]   file size high
  624.                                smb_vwv[6]   access allowed
  625.                                smb_bcc      0
  626.  __________________________________________________________
  627.  
  628.  
  629.  
  630. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  631.  
  632.  
  633.  
  634.  
  635. File Sharing Protocol      - 10 -           November 7, 1988
  636.  
  637.  
  638.  |||||||||||||||||||||||||||||||||||||||||
  639.                              |||||||||||||||||||||||||||||||||||||||||
  640.                                                            |||||||||||||||||||||||||||||||||||||||||
  641. This message is sent to obtain a  file  handle  for  a  data
  642. file.   The  relevant  tree  id and any necessary additional
  643. pathname are passed.  The handle returned  can  be  used  in
  644. subsequent  read,  write,  lock,  unlock and close messages.
  645. The file size and last modification time are also  returned.
  646. The  r/w/share  word  controls  the  mode.  The file will be
  647. opened only if the requester  has  the  appropriate  permis-
  648. sions.   The  r/w/share  word  has  the following format and
  649. values.
  650.  
  651.         r/w/share format:  - - - -  - - - -  rxxx  yyyy
  652.  
  653.  
  654.      where:  r =   reserved
  655.       xxx = 0 --
  656.                    MS-DOS Compatibility mode (exclusive to a VC, but that VC may  have  multiple
  657.                    opens).   Support  of this mode is optional.  However, if it is not supported
  658.                    or is mapped to exclusive open modes, some existing MS-DOS  applications  may
  659.                    not  work  with network files. If reading map to deny write, otherwise map to
  660.                    deny read/write.
  661.             1 --   Deny read/write (exclusive to this open operation).
  662.             2 --   Deny write -- other users may access file in READ mode.
  663.             3 --
  664.                    Deny read -- other users may access file in WRITE mode.  Support of this mode
  665.                    is optional.
  666.             4 --   Deny none -- allow other users to access file in any mode for which they have
  667.                    permission.
  668.      yyyy = 0 --   Open file for reading.
  669.             1 --   Open file for writing.
  670.             2 --   Open file for reading and writing.
  671.      rxxx yyyy =   11111111 (hex FF)
  672.  
  673.                    FCB open: This type of open will cause an MS-DOS compatibility mode open with
  674.                    the  read/write  modes set to the maximum permissible, i.e., if the requester
  675.                    can have read and write access on the file, it will be opened  in  read/write
  676.                    mode.
  677.  
  678. The response message indicates the access permissions  actu-
  679. ally  allowed in the "access allowed" field.  This field may
  680. have the following values:
  681.  
  682.         0 = read-only
  683.         1 = write-only
  684.         2 = read/write
  685.  
  686. File Sharing Notes:
  687.  
  688. 1.   File Handles (FIDs) are contained  within  the  Virtual
  689.      Circuit  (VC) environment.  A PID may reference any FID
  690.      established by itself or any other PID within  its  VC.
  691.      The actual accesses allowed through the FID will depend
  692.      on the open and deny modes specified when the file  was
  693.      opened (see below).
  694.  
  695.  
  696. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  697.  
  698.  
  699.  
  700.  
  701.  
  702. File Sharing Protocol      - 11 -           November 7, 1988
  703.  
  704.  
  705. 2.   The MS-DOS compatibility mode  of  file  open  provides
  706.      exclusion  at the VC level.  A file open in compatibil-
  707.      ity mode may be opened (also in compatibility mode) any
  708.      number  of  times  for  any  combination of reading and
  709.      writing (subject to the user's permissions) by any  PID
  710.      within  the  owning  VC.   If the first VC has the file
  711.      open for writing, then the file may not  be  opened  in
  712.      any  way by any PID within another VC.  If the first VC
  713.      has the file open only for reading, then other VCs  may
  714.      open  the  file,  in  compatibility  mode, for reading.
  715.      Once multiple VCs have the file open for reading, no VC
  716.      is  permitted  to  open the file for writing.  No VC or
  717.      PID may open the file in any mode other  than  compati-
  718.      bility mode.
  719.  
  720. 3.   The other file exclusion modes (Deny  read/write,  Deny
  721.      write,  Deny  read, Deny none) provide exclusion at the
  722.      file level.  A file opened in any "Deny"  mode  may  be
  723.      opened  again only for the accesses allowed by the Deny
  724.      mode (subject to the user's permissions).  This is true
  725.      regardless  of  the  identity of the second opener -- a
  726.      PID within another VC, a PID within the same VC, or the
  727.      PID  that already has the file open.  For example, if a
  728.      file is open in "Deny write" mode  a  second  open  may
  729.      only obtain read permission to the file.
  730.  
  731. 4.   Although FIDs are available to all PIDs on a  VC,  PIDs
  732.      other  than  the  owner  may  not  have the full access
  733.      rights specified in the open mode by the FID's creator.
  734.      If  the  open  creating  the FID specified a deny mode,
  735.      then any PID using the FID,  other  than  the  creating
  736.      PID,  will  have only those access rights determined by
  737.      "anding" the open mode rights and the deny mode rights,
  738.      i.e.,  the  deny  mode is checked on all file accesses.
  739.      For example, if a file is opened for Read/Write in Deny
  740.      write  mode,  then other VC PIDs may only read from the
  741.      FID and cannot write; if a file is opened for  Read  in
  742.      Deny read mode, then the other VC PIDs can neither read
  743.      nor write the FID.
  744.  
  745. If a file cannot be opened for any reason, including a  con-
  746. flict  of  share modes, a reply message indicating the cause
  747. of the failure will be returned.
  748.  
  749. Open may generate the following errors:
  750.  
  751.         Error Class ERRDOS:
  752.  
  753.           ERRbadfile
  754.           ERRnofids
  755.           ERRnoaccess
  756.           ERRshare
  757.  
  758.  
  759.  
  760.  
  761.  
  762. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  763.  
  764.  
  765.  
  766.  
  767.  
  768. File Sharing Protocol      - 12 -           November 7, 1988
  769.  
  770.  
  771.  
  772.         Error Class ERRSRV:
  773.  
  774.           ERRerror
  775.           ERRaccess
  776.           ERRinvnid
  777.           ERRinvdevice
  778.           <implementation specific>
  779.  
  780.  
  781.         Error Class ERRHRD:
  782.  
  783.           <implementation specific>
  784.  
  785.  
  786. _5._2.  _C_r_e_a_t_e _F_i_l_e
  787.  
  788.  
  789.   _______________________________________________________
  790.    >From Consumer               To Consumer
  791.   _______________________________________________________
  792.    smb_com      SMBcreate       smb_com      SMBcreate
  793.    smb_wct      3               smb_wct      1
  794.    smb_vwv[0]   attribute       smb_vwv[0]   file handle
  795.    smb_vwv[1]   time low        smb_bcc      0
  796.    smb_vwv[2]   time high
  797.    smb_bcc      min = 2
  798.    smb_buf[]    ASCII -- 04
  799.                 file pathname
  800.   _______________________________________________________
  801.   ||||||||||
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.                               ||||||||||
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.                                                          ||||||||||
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830. This message is sent to create a new data file  or  truncate
  831. an  existing  data  file  to length zero, and open the file.
  832. The handle returned can be used in subsequent  read,  write,
  833. lock, unlock and close messages.
  834.  
  835. Unprotected servers will require requesters to  have  create
  836. permission  for  the subtree containing the file in order to
  837. create a new file, or write permission for  the  subtree  in
  838. order  to  truncate an existing one.  The newly created file
  839. will be opened in compatibility mode with  the  access  mode
  840. determined by the containing subtree permissions.
  841.  
  842. Protected servers will require requesters to have write per-
  843. mission  on the file's parent directory in order to create a
  844. new file, or write permission on the file itself in order to
  845. truncate  it.   The  access permissions granted on a created
  846. file will be read/write permission for the creator.   Access
  847. permissions for truncated files are not modified.  The newly
  848. created    or    truncated     file     is     opened     in
  849. read/write/compatibility mode.
  850.  
  851. Support of the  create  time  supplied  in  the  request  is
  852. optional.
  853.  
  854. Create may generate the following errors:
  855.  
  856.  
  857. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  858.  
  859.  
  860.  
  861.  
  862.  
  863. File Sharing Protocol      - 13 -           November 7, 1988
  864.  
  865.  
  866.  
  867.         Error Class ERRDOS:
  868.  
  869.           ERRbadpath
  870.           ERRnofids
  871.           ERRnoaccess
  872.           ERRbadaccess
  873.  
  874.  
  875.         Error Class ERRSRV:
  876.  
  877.           ERRerror
  878.           ERRaccess
  879.           ERRinvnid
  880.           ERRinvdevice
  881.           <implementation specific>
  882.  
  883.  
  884.         Error Class ERRHRD:
  885.  
  886.           <implementation specific>
  887.  
  888.  
  889. _5._3.  _C_l_o_s_e _F_i_l_e
  890.  
  891.  
  892.       _______________________________________________
  893.        >From Consumer             To Consumer
  894.       _______________________________________________
  895.        smb_com      SMBclose      smb_com   SMBclose
  896.        smb_wct      3             smb_wct   0
  897.        smb_vwv[0]   file handle   smb_bcc   0
  898.        smb_vwv[1]   time low
  899.        smb_vwv[2]   time high
  900.        smb_bcc      0
  901.       _______________________________________________
  902.       ||||||||
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.                                 ||||||||
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.                                                      ||||||||
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925. The close message is sent to invalidate a  file  handle  for
  926. the  requesting  process.  All  locks held by the requesting
  927. process on the file will be "unlocked".  The requesting pro-
  928. cess  can  no  longer  use  the file handle for further file
  929. access requests.  The new modification time may be passed to
  930. the  server.   Server  support  of  the modification time is
  931. optional; it may be ignored.
  932.  
  933. Close will cause all the file's buffers  to  be  flushed  to
  934. disk.
  935.  
  936. Close may generate the following errors:
  937.  
  938.         Error Class ERRDOS:
  939.  
  940.           ERRbadfid
  941.           ERRnoaccess
  942.  
  943.  
  944.  
  945. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  946.  
  947.  
  948.  
  949.  
  950.  
  951. File Sharing Protocol      - 14 -           November 7, 1988
  952.  
  953.  
  954.  
  955.         Error Class ERRSRV:
  956.  
  957.           ERRerror
  958.           ERRinvdevice
  959.           ERRinvnid
  960.           <implementation specific>
  961.  
  962.  
  963.         Error Class ERRHRD:
  964.  
  965.           <implementation specific>
  966.  
  967.  
  968. _5._4.  _F_l_u_s_h _F_i_l_e
  969.  
  970.  
  971.       _______________________________________________
  972.        >From Consumer             To Consumer
  973.       _______________________________________________
  974.        smb_com      SMBflush      smb_com   SMBflush
  975.        smb_wct      1             smb_wct   0
  976.        smb_vwv[0]   file handle   smb_bcc   0
  977.        smb_bcc      0
  978.       _______________________________________________
  979.       ||||||
  980.  
  981.  
  982.  
  983.  
  984.                                 ||||||
  985.  
  986.  
  987.  
  988.  
  989.                                                      ||||||
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996. The flush message is sent to ensure all data and  allocation
  997. information  for  the corresponding file has been written to
  998. non-volatile storage.  When the file handle has a  value  -1
  999. (hex FFFF) the server will perform a flush for all file han-
  1000. dles associated with the consumer's process.   The  response
  1001. is not sent until the writes are complete.
  1002.  
  1003. Note that this protocol  does  not  require  that  only  the
  1004. specific  file's  data  be  written (flushed).  It specifies
  1005. that "at least" the file's data be written.
  1006.  
  1007. Flush may generate the following errors:
  1008.  
  1009.         Error Class ERRDOS:
  1010.  
  1011.           ERRbadfid
  1012.           ERRnoaccess
  1013.           <implementation specific>
  1014.  
  1015.  
  1016.         Error Class ERRSRV:
  1017.  
  1018.           ERRerror
  1019.           ERRinvdevice
  1020.           ERRinvnid
  1021.           <implementation specific>
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033. File Sharing Protocol      - 15 -           November 7, 1988
  1034.  
  1035.  
  1036.  
  1037.         Error Class ERRHRD:
  1038.  
  1039.           <implementation specific>
  1040.  
  1041.  
  1042. _5._5.  _R_e_a_d
  1043.  
  1044.  
  1045. _________________________________________________________________
  1046.  >From Consumer                To Consumer
  1047. _________________________________________________________________
  1048.  smb_com      SMBread          smb_com        SMBread
  1049.  smb_wct      5                smb_wct        5
  1050.  smb_vwv[0]   file handle      smb_vwv[0]     count
  1051.  smb_vwv[1]   count of bytes   smb_vwv[1-4]   reserved (MBZ)
  1052.  smb_vwv[2]   offset low       smb_bcc        length of data + 3
  1053.  smb_vwv[3]   offset high      smb_buf[]      Data Block -- 01
  1054.  smb_vwv[4]   count left                      length of data
  1055.  smb_bcc      0                               data
  1056. _________________________________________________________________
  1057. ||||||||||
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066.                              ||||||||||
  1067.  
  1068.  
  1069.  
  1070.  
  1071.  
  1072.  
  1073.  
  1074.  
  1075.                                                                  ||||||||||
  1076.  
  1077.  
  1078.  
  1079.  
  1080.  
  1081.  
  1082.  
  1083.  
  1084.  
  1085.  
  1086. The read message is sent to read bytes of a data file.   The
  1087. count of bytes field is used to specify the requested number
  1088. of bytes. The offset field specifies the offset in the  file
  1089. of  the  first  byte  to  be  read.  The count left field is
  1090. advisory.  If the value is not zero, then it is taken as  an
  1091. estimate  of  the total number of bytes that will be read --
  1092. including those  read  by  this  request.   This  additional
  1093. information  may  be  used  by the server to optimize buffer
  1094. allocation or read-ahead.
  1095.  
  1096. The count field in the response message indicates the number
  1097. of bytes actually being returned.  The count returned may be
  1098. less than the count requested only if a read specifies bytes
  1099. beyond  the  current file size.  In this case only the bytes
  1100. that exist are returned.  A read completely beyond  the  end
  1101. of  file  will result in a response of length zero.  This is
  1102. the only circumstance when a zero length  response  is  gen-
  1103. erated.   A  count  returned  which  is  less than the count
  1104. requested is the end of file indicator.
  1105.  
  1106. If a Read requests more data than can be placed in a message
  1107. of  the max-xmit-size for the TID specified, the server will
  1108. abort the virtual circuit to the consumer.
  1109.  
  1110. Read may generate the following errors:
  1111.  
  1112.         Error Class ERRDOS:
  1113.  
  1114.           ERRnoaccess
  1115.           ERRbadfid
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127. File Sharing Protocol      - 16 -           November 7, 1988
  1128.  
  1129.  
  1130.  
  1131.         Error Class ERRSRV:
  1132.  
  1133.           ERRerror
  1134.           ERRinvdevice
  1135.           ERRinvnid
  1136.           <implementation specific>
  1137.  
  1138.  
  1139.         Error Class ERRHRD:
  1140.  
  1141.           <implementation specific>
  1142.  
  1143.  
  1144. _5._6.  _W_r_i_t_e
  1145.  
  1146.  
  1147.  _________________________________________________________
  1148.   >From Consumer                    To Consumer
  1149.  _________________________________________________________
  1150.   smb_com      SMBwrite             smb_com      SMBwrite
  1151.   smb_wct      5                    smb_wct      1
  1152.   smb_vwv[0]   file handle          smb_vwv[0]   count
  1153.   smb_vwv[1]   count of bytes       smb_bcc      0
  1154.   smb_vwv[2]   offset low
  1155.   smb_vwv[3]   offset high
  1156.   smb_vwv[4]   count left
  1157.   smb_bcc      length of data + 3
  1158.   smb_buf[]    Data Block -- 01
  1159.                length of data
  1160.                data
  1161.  _________________________________________________________
  1162.  |||||||||||||
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.                                   |||||||||||||
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.                                                           |||||||||||||
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200. The write message is sent to write bytes into a  data  file.
  1201. The count of bytes field specifies the number of bytes to be
  1202. written.  The offset field specifies the offset in the  file
  1203. of  the  first  byte to be written.  The count left field is
  1204. advisory. If the value is not zero, then it is taken  as  an
  1205. estimate  of  the  number  of  bytes that will be written --
  1206. including those written by this  request.   This  additional
  1207. information  may  be  used  by the server to optimize buffer
  1208. allocation.
  1209.  
  1210. The count field in the response message indicates the actual
  1211. number  of  bytes  written,  and  for successful writes will
  1212. always equal the count  in  the  request  message.   If  the
  1213. number  of  bytes  written differs from the number requested
  1214. and no error is indicated, then the server has no disk space
  1215. available with which to satisfy the complete write.
  1216.  
  1217. When a write specifies a byte range beyond the  current  end
  1218. of  file,  the file will be extended.  Any bytes between the
  1219. previous end of file and the requested offset will be set to
  1220. zero (ASCII nul).
  1221.  
  1222. When a write specifies a length of zero, the  file  will  be
  1223.  
  1224.  
  1225. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231. File Sharing Protocol      - 17 -           November 7, 1988
  1232.  
  1233.  
  1234. truncated to the length specified by the offset.
  1235.  
  1236. If a Write sends a message of length greater than  the  max-
  1237. xmit-size  for  the TID specified, the server will abort the
  1238. virtual circuit to the consumer.
  1239.  
  1240. Write may generate the following errors:
  1241.  
  1242.         Error Class ERRDOS:
  1243.  
  1244.           ERRnoaccess
  1245.           ERRbadfid
  1246.  
  1247.  
  1248.         Error Class ERRSRV:
  1249.  
  1250.           ERRerror
  1251.           ERRinvdevice
  1252.           ERRinvnid
  1253.           <implementation specific>
  1254.  
  1255.  
  1256.         Error Class ERRHRD:
  1257.  
  1258.           <implementation specific>
  1259.  
  1260.  
  1261. _5._7.  _S_e_e_k
  1262.  
  1263.  
  1264.    _____________________________________________________
  1265.     >From Consumer             To Consumer
  1266.    _____________________________________________________
  1267.     smb_com      SMBlseek      smb_com      SMBlseek
  1268.     smb_wct      4             smb_wct      2
  1269.     smb_vwv[0]   file handle   smb_vwv[0]   offset-low
  1270.     smb_vwv[1]   mode          smb_vwv[1]   offset-high
  1271.     smb_vwv[2]   offset-low    smb_bcc      0
  1272.     smb_vwv[2]   offset-high
  1273.     smb_bcc      min = 0
  1274.    _____________________________________________________
  1275.    |||||||||
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.                              |||||||||
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.                                                         |||||||||
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301. The seek message is sent to set the current file pointer for
  1302. the  requesting  process.  The starting point of the seek is
  1303. set by the "mode" field in the request.  This may  have  the
  1304. following values:
  1305.  
  1306.         0 = seek from start of file
  1307.         1 = seek from current file pointer
  1308.         2 = seek from end of file
  1309.  
  1310. The response returns the new file pointer expressed  as  the
  1311. offset  from  the  start  of the file, and may be beyond the
  1312. current end of file.  An attempt to seek to before the start
  1313. of file set the file pointer to start of file.
  1314.  
  1315.  
  1316. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322. File Sharing Protocol      - 18 -           November 7, 1988
  1323.  
  1324.  
  1325. Note: the "current file pointer" at the start of  this  com-
  1326. mand  reflects  the offset plus data length specified in the
  1327. previous read, write or seek request, and the pointer set by
  1328. this command will be replaced by the offset specified in the
  1329. next read, write or seek command.
  1330.  
  1331. Seek may generate the following errors:
  1332.  
  1333.         Error Class ERRDOS:
  1334.  
  1335.           ERRnoaccess
  1336.           Errbadfid
  1337.           <implementation specific>
  1338.  
  1339.  
  1340.         Error Class ERRSRV:
  1341.  
  1342.           ERRerror
  1343.           ERRinvnid
  1344.           <implementation specific>
  1345.  
  1346.  
  1347.         Error Class ERRHRD:
  1348.  
  1349.           <implementation specific>
  1350.  
  1351.  
  1352. _5._8.  _C_r_e_a_t_e _D_i_r_e_c_t_o_r_y
  1353.  
  1354.  
  1355.       _______________________________________________
  1356.        >From Consumer             To Consumer
  1357.       _______________________________________________
  1358.        smb_com     SMBmkdir       smb_com   SMBmkdir
  1359.        smb_wct     0              smb_wct   0
  1360.        smb_bcc     min = 2        smb_bcc   0
  1361.        smb_buf[]   ASCII -- 04
  1362.                    dir pathname
  1363.       _______________________________________________
  1364.       |||||||
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.                                 |||||||
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.                                                      |||||||
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384. The create directory message is sent to create a new  direc-
  1385. tory.   The  appropriate  TID  and  additional  pathname are
  1386. passed.  The directory must not exist for it to be created.
  1387.  
  1388. Unprotected servers will require requesters to  have  create
  1389. permission for the subtree containing the directory in order
  1390. to create a new directory.  The creator's access  rights  to
  1391. the  new directory will be determined by the containing sub-
  1392. tree permissions.
  1393.  
  1394. Protected servers will require requesters to have write per-
  1395. mission on the new directory's parent directory.  The access
  1396. permissions  granted  on  a  created   directory   will   be
  1397. read/write permission for the creator.
  1398.  
  1399. Create Directory may generate the following errors:
  1400.  
  1401.  
  1402. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  1403.  
  1404.  
  1405.  
  1406.  
  1407.  
  1408. File Sharing Protocol      - 19 -           November 7, 1988
  1409.  
  1410.  
  1411.  
  1412.         Error Class ERRDOS:
  1413.  
  1414.           ERRbadpath
  1415.           ERRnoaccess
  1416.  
  1417.  
  1418.         Error Class ERRSRV:
  1419.  
  1420.           ERRerror
  1421.           ERRaccess
  1422.           ERRinvnid
  1423.           <implementation specific>
  1424.  
  1425.  
  1426.         Error Class ERRHRD:
  1427.  
  1428.           <implementation specific>
  1429.  
  1430.  
  1431. _5._9.  _D_e_l_e_t_e _D_i_r_e_c_t_o_r_y
  1432.  
  1433.  
  1434.       _______________________________________________
  1435.        >From Consumer             To Consumer
  1436.       _______________________________________________
  1437.        smb_com     SMBrmdir       smb_com   SMBrmdir
  1438.        smb_wct     0              smb_wct   0
  1439.        smb_bcc     min = 2        smb_bcc   0
  1440.        smb_buf[]   ASCII -- 04
  1441.                    dir pathname
  1442.       _______________________________________________
  1443.       |||||||
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.                                 |||||||
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.                                                      |||||||
  1456.  
  1457.  
  1458.  
  1459.  
  1460.  
  1461.  
  1462.  
  1463. The delete directory message is  sent  to  delete  an  empty
  1464. directory.   The appropriate TID and additional pathname are
  1465. passed.  The directory must be empty for it to be deleted.
  1466.  
  1467. Unprotected servers will require the requester to have write
  1468. permission  to  the  subtree  containing the directory to be
  1469. deleted.
  1470.  
  1471. Protected servers will require the requester to  have  write
  1472. permission to the target directory's parent directory.
  1473.  
  1474. The effect of a delete will be, to some extent, dependent on
  1475. the  nature  of  the  server.   Normally only the referenced
  1476. directory name is deleted, the directory contents  are  only
  1477. deleted when all the directory's names have been deleted.
  1478.  
  1479. In some cases a delete will cause immediate  destruction  of
  1480. the directory contents.
  1481.  
  1482. Delete Directory may generate the following errors:
  1483.  
  1484.  
  1485.  
  1486.  
  1487. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493. File Sharing Protocol      - 20 -           November 7, 1988
  1494.  
  1495.  
  1496.  
  1497.         Error Class ERRDOS:
  1498.  
  1499.           ERRbadpath
  1500.           ERRnoaccess
  1501.           ERRremcd
  1502.  
  1503.  
  1504.         Error Class ERRSRV:
  1505.  
  1506.           ERRerror
  1507.           ERRaccess
  1508.           ERRinvnid
  1509.           <implementation specific>
  1510.  
  1511.  
  1512.         Error Class ERRHRD:
  1513.  
  1514.           <implementation specific>
  1515.  
  1516.  
  1517. _5._1_0.  _D_e_l_e_t_e _F_i_l_e
  1518.  
  1519.  
  1520.      __________________________________________________
  1521.       >From Consumer               To Consumer
  1522.      __________________________________________________
  1523.       smb_com      SMBunlink       smb_com   SMBunlink
  1524.       smb_wct      1               smb_wct   0
  1525.       smb_vwv[0]   attribute       smb_bcc   0
  1526.       smb_bcc      min = 2
  1527.       smb_buf[]    ASCII -- 04
  1528.                    file pathname
  1529.      __________________________________________________
  1530.      ||||||||
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.                                  ||||||||
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.                                                        ||||||||
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553. The delete file message is sent to delete a data file.   The
  1554. appropriate  TID and additional pathname are passed.  A file
  1555. must exist for it to be deleted.  Read only files may not be
  1556. deleted, the read-only attribute must be reset prior to file
  1557. deletion.
  1558.  
  1559. Multiple files may  be  deleted  in  response  to  a  single
  1560. request  as  Delete  File  supports "wild cards" in the file
  1561. name (last component of the pathname).  "?" is the wild card
  1562. for  single  characters, "*" or "null" will match any number
  1563. of filename characters within a single part of the  filename
  1564. component.   The  filename  is  divided into two parts -- an
  1565. eight character name and a three character  extension.   The
  1566. name and extension are divided by a ".".
  1567.  
  1568. If a filename part commences with  one  or  more  "?"s  then
  1569. exactly  that  number  of  characters will be matched by the
  1570. wildcards, e.g., "??x" will equal "abx" but  not  "abcx"  or
  1571. "ax".   When  a filename part has trailing "?"s then it will
  1572. match the specified number  of  characters  or  less,  e.g.,
  1573. "x??"  will  match  "xab", "xa" and "x", but not "xabc".  If
  1574.  
  1575.  
  1576. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582. File Sharing Protocol      - 21 -           November 7, 1988
  1583.  
  1584.  
  1585. only "?"s are present in the filename part, then it is  han-
  1586. dled as for trailing "?"s
  1587.  
  1588. "*" or "null" match entire pathname parts, thus  "*.abc"  or
  1589. ".abc"  will  match  any  file  with  an extension of "abc".
  1590. "*.*", "*" or "null" will match all files in a directory.
  1591.  
  1592. The attribute field indicates the attributes that the target
  1593. file(s)  must have.  If the attribute is zero then only nor-
  1594. mal files are deleted.  If the system file or hidden  attri-
  1595. butes are specified then the delete is inclusive -- both the
  1596. specified type(s) of files and normal files are deleted.
  1597.  
  1598. Unprotected servers will require the requester to have write
  1599. permission to the subtree containing the file to be deleted.
  1600.  
  1601. Protected servers will require the requester to  have  write
  1602. permission to the target file's parent directory.
  1603.  
  1604. The effect of a delete will be, to some extent, dependent on
  1605. the nature of the server.  Normally only the referenced file
  1606. name is deleted, the file contents are only deleted when all
  1607. the  file's  names  have  been  deleted and all file handles
  1608. associated with it have been destroyed (closed).
  1609.  
  1610. In some cases (notably MS-DOS) a delete will cause immediate
  1611. destruction  of  the  file  contents and invalidation of all
  1612. fids associated with the file.
  1613.  
  1614. Delete File may generate the following errors:
  1615.  
  1616.         Error Class ERRDOS:
  1617.  
  1618.           ERRbadfile
  1619.           ERRnoaccess
  1620.  
  1621.  
  1622.         Error Class ERRSRV:
  1623.  
  1624.           ERRerror
  1625.           ERRaccess
  1626.           ERRinvnid
  1627.           <implementation specific>
  1628.  
  1629.  
  1630.         Error Class ERRHRD:
  1631.  
  1632.           <implementation specific>
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648. File Sharing Protocol      - 22 -           November 7, 1988
  1649.  
  1650.  
  1651. _5._1_1.  _R_e_n_a_m_e _F_i_l_e
  1652.  
  1653.  
  1654.     ___________________________________________________
  1655.      >From Consumer                    To Consumer
  1656.     ___________________________________________________
  1657.      smb_com      SMBmv                smb_com   SMBmv
  1658.      smb_wct      1                    smb_wct   0
  1659.      smb_vwv[0]   attribute            smb_bcc   0
  1660.      smb_bcc      min = 4
  1661.      smb_buf[]    ASCII -- 04
  1662.                   old file pathname
  1663.                   ASCII -- 04
  1664.                   new file pathname
  1665.     ___________________________________________________
  1666.     ||||||||||
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.                                      ||||||||||
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682.  
  1683.  
  1684.                                                        ||||||||||
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695. The rename file message is sent to  change  the  name  of  a
  1696. file.   The  first  file  pathname must exist and the second
  1697. must not.  Both pathnames must be relative to the tid speci-
  1698. fied in the request.  Open files may be renamed.
  1699.  
  1700. Multiple files may  be  renamed  in  response  to  a  single
  1701. request  as  Rename  File  supports "wild cards" in the file
  1702. name (last component of the pathname).  The wild card match-
  1703. ing algorithm is described in the "Delete File" description.
  1704.  
  1705. The attribute field indicates the attributes that the target
  1706. file(s)  must have.  If the attribute is zero then only nor-
  1707. mal files are renamed.  If the system file or hidden  attri-
  1708. butes are specified then the rename is inclusive -- both the
  1709. specified type(s) of files and normal files are renamed.
  1710.  
  1711. Unprotected servers require the requester to have both  read
  1712. and create permissions to the referenced subtree.
  1713.  
  1714. Protected servers require the requester to have  write  per-
  1715. mission  to  the  parent  directories of both the source and
  1716. destination files.
  1717.  
  1718. Rename is guaranteed to succeed if only the  last  component
  1719. of  the  file  pathnames differs.  Other rename requests may
  1720. succeed depending on the server implementation used.
  1721.  
  1722. Rename may generate the following errors:
  1723.  
  1724.         Error Class ERRDOS:
  1725.  
  1726.           ERRbadfile
  1727.           ERRnoaccess
  1728.           ERRdiffdevice
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  1737.  
  1738.  
  1739.  
  1740.  
  1741.  
  1742. File Sharing Protocol      - 23 -           November 7, 1988
  1743.  
  1744.  
  1745.  
  1746.         Error Class ERRSRV:
  1747.  
  1748.           ERRerror
  1749.           ERRaccess
  1750.           ERRinvnid
  1751.           <implementation specific>
  1752.  
  1753.  
  1754.         Error Class ERRHRD:
  1755.  
  1756.           <implementation specific>
  1757.  
  1758.  
  1759. _5._1_2.  _G_e_t _F_i_l_e _A_t_t_r_i_b_u_t_e_s
  1760.  
  1761.  
  1762. ___________________________________________________________
  1763.  >From Consumer              To Consumer
  1764. ___________________________________________________________
  1765.  smb_com     SMBgetatr       smb_com        SMBgetatr
  1766.  smb_wct     0               smb_wct        10
  1767.  smb_bcc     min = 2         smb_vwv[0]     attribute
  1768.  smb_buf[]   ASCII -- 04     smb_vwv[1]     time1 low
  1769.              file pathname   smb_vwv[2]     time1 high
  1770.                              smb_vwv[3]     file size low
  1771.                              smb_vwv[4]     file size high
  1772.                              smb_vwv[5-9]   reserved (MBZ)
  1773.                              smb_bcc        0
  1774. ___________________________________________________________
  1775. |||||||||||
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.                            |||||||||||
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791.  
  1792.  
  1793.  
  1794.  
  1795.                                                            |||||||||||
  1796.  
  1797.  
  1798.  
  1799.  
  1800.  
  1801.  
  1802.  
  1803.  
  1804.  
  1805.  
  1806.  
  1807. The get file attributes message is sent to  obtain  informa-
  1808. tion  about  a  file.   The  attribute, time1, and file size
  1809. fields must contain valid values for data files. The  attri-
  1810. bute  and  time1 fields must contain valid values for direc-
  1811. tories.
  1812.  
  1813. Get File Attributes may generate the following errors:
  1814.  
  1815.         Error Class ERRDOS:
  1816.  
  1817.           ERRbadfile
  1818.           <implementation specific>
  1819.  
  1820.  
  1821.         Error Class ERRSRV:
  1822.  
  1823.           ERRerror
  1824.           ERRinvnid
  1825.           <implementation specific>
  1826.  
  1827.  
  1828.         Error Class ERRHRD:
  1829.  
  1830.           <implementation specific>
  1831.  
  1832.  
  1833. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839. File Sharing Protocol      - 24 -           November 7, 1988
  1840.  
  1841.  
  1842. _5._1_3.  _S_e_t _F_i_l_e _A_t_t_r_i_b_u_t_e_s
  1843.  
  1844.  
  1845.    _____________________________________________________
  1846.     >From Consumer                  To Consumer
  1847.    _____________________________________________________
  1848.     smb_com        SMBsetatr        smb_com   SMBsetatr
  1849.     smb_wct        8                smb_wct   0
  1850.     smb_vwv[0]     attribute        smb_bcc   0
  1851.     smb_vwv[1]     time1 low
  1852.     smb_vwv[2]     time1 high
  1853.     smb_vwv[3-7]   reserved (MBZ)
  1854.     smb_bcc        min = 2
  1855.     smb_buf[]      ASCII -- 04
  1856.                    file pathname
  1857.     smb_nul[]      ASCII -- 04
  1858.                    null string
  1859.    _____________________________________________________
  1860.    |||||||||||||
  1861.  
  1862.  
  1863.  
  1864.  
  1865.  
  1866.  
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.                                   |||||||||||||
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.                                                         |||||||||||||
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898. The set file attributes message is sent to change the infor-
  1899. mation about a file.  Support of all parameters is optional.
  1900. A server which does not implement one of the parameters will
  1901. ignore that field. If the time1 field contains zero then the
  1902. file's time is not changed.
  1903.  
  1904. Unprotected servers require the requester to have write per-
  1905. mission to the subtree containing the referenced file.
  1906.  
  1907. Protected servers will allow the owner of the  file  to  use
  1908. this  command.  Other legitimate users will be server depen-
  1909. dent.
  1910.  
  1911. Set File Attributes may generate the following errors:
  1912.  
  1913.         Error Class ERRDOS:
  1914.  
  1915.           ERRbadfunc
  1916.           ERRbadpath
  1917.           ERRnoaccess
  1918.  
  1919.  
  1920.         Error Class ERRSRV:
  1921.  
  1922.           ERRerror
  1923.           ERRinvnid
  1924.           ERRaccess
  1925.           <implementation specific>
  1926.  
  1927.  
  1928.         Error Class ERRHRD:
  1929.  
  1930.           <implementation specific>
  1931.  
  1932.  
  1933.  
  1934.  
  1935.  
  1936. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  1937.  
  1938.  
  1939.  
  1940.  
  1941.  
  1942. File Sharing Protocol      - 25 -           November 7, 1988
  1943.  
  1944.  
  1945. _5._1_4.  _L_o_c_k _R_e_c_o_r_d
  1946.  
  1947.  
  1948.        ______________________________________________
  1949.         >From Consumer             To Consumer
  1950.        ______________________________________________
  1951.         smb_com      SMBlock       smb_com   SMBlock
  1952.         smb_wct      5             smb_wct   0
  1953.         smb_vwv[0]   file handle   smb_bcc   0
  1954.         smb_vwv[1]   count low
  1955.         smb_vwv[2]   count high
  1956.         smb_vwv[3]   offset low
  1957.         smb_vwv[4]   offset high
  1958.         smb_bcc      0
  1959.        ______________________________________________
  1960.        ||||||||||
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.                                  ||||||||||
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.                                                      ||||||||||
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.  
  1988.  
  1989. The lock record message is  sent  to  lock  the  given  byte
  1990. range.   More  than  one  non-overlapping  byte range may be
  1991. locked in a given file.  Locks are coercive in nature.  They
  1992. prevent  attempts  to lock, read or write the locked portion
  1993. of the file.   Overlapping  locks  are  not  allowed.   File
  1994. addresses  beyond  the  current  end  of file may be locked.
  1995. Such locks will not cause allocation of file space.
  1996.  
  1997. Locks may only be unlocked by the process  (pid)  that  per-
  1998. formed  the  lock.  The ability to perform locks is not tied
  1999. to any file access permission.
  2000.  
  2001. Lock may generate the following errors:
  2002.  
  2003.         Error Class ERRDOS:
  2004.  
  2005.           ERRbadfid
  2006.           ERRlock
  2007.           <implementation specific>
  2008.  
  2009.  
  2010.         Error Class ERRSRV:
  2011.  
  2012.           ERRerror
  2013.           ERRinvdevice
  2014.           ERRinvnid
  2015.           <implementation specific>
  2016.  
  2017.  
  2018.         Error Class ERRHRD:
  2019.  
  2020.           <implementation specific>
  2021.  
  2022.  
  2023. _5._1_5.  _U_n_l_o_c_k _R_e_c_o_r_d
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036. File Sharing Protocol      - 26 -           November 7, 1988
  2037.  
  2038.  
  2039.       ________________________________________________
  2040.        >From Consumer             To Consumer
  2041.       ________________________________________________
  2042.        smb_com      SMBunlock     smb_com   SMBunlock
  2043.        smb_wct      5             smb_wct   0
  2044.        smb_vwv[0]   file handle   smb_bcc   0
  2045.        smb_vwv[1]   count low
  2046.        smb_vwv[2]   count high
  2047.        smb_vwv[3]   offset low
  2048.        smb_vwv[4]   offset high
  2049.        smb_bcc      0
  2050.       ________________________________________________
  2051.       ||||||||||
  2052.  
  2053.  
  2054.  
  2055.  
  2056.  
  2057.  
  2058.  
  2059.  
  2060.                                 ||||||||||
  2061.  
  2062.  
  2063.  
  2064.  
  2065.  
  2066.  
  2067.  
  2068.  
  2069.                                                       ||||||||||
  2070.  
  2071.  
  2072.  
  2073.  
  2074.  
  2075.  
  2076.  
  2077.  
  2078.  
  2079.  
  2080. The unlock record message is sent to unlock the  given  byte
  2081. range.   The  byte range must be identical to that specified
  2082. in a prior successful lock request, and the unlock requester
  2083. (pid)  must  be  the  same as the lock holder.  If an unlock
  2084. references an address range that is not locked it is treated
  2085. as a no-op -- no action is taken and no error is generated.
  2086.  
  2087. Unlock may generate the following errors:
  2088.  
  2089.         Error Class ERRDOS:
  2090.  
  2091.           ERRbadfid
  2092.           ERRlock
  2093.           <implementation specific>
  2094.  
  2095.  
  2096.         Error Class ERRSRV:
  2097.  
  2098.           ERRerror
  2099.           ERRinvdevice
  2100.           ERRinvnid
  2101.           <implementation specific>
  2102.  
  2103.  
  2104.         Error Class ERRHRD:
  2105.  
  2106.           <implementation specific>
  2107.  
  2108.  
  2109. _5._1_6.  _C_r_e_a_t_e _T_e_m_p_o_r_a_r_y _F_i_l_e
  2110.  
  2111.  
  2112. __________________________________________________________________
  2113.  >From Consumer                    To Consumer
  2114. __________________________________________________________________
  2115.  smb_com      SMBctemp             smb_com      SMBctemp
  2116.  smb_wct      3                    smb_wct      1
  2117.  smb_vwv[0]   attribute            smb_vwv[0]   file handle
  2118.  smb_vwv[1]   time low             smb.bcc      min = 2
  2119.  smb_vwv[2]   time high            smb_buf[]    ASCII -- 04
  2120.  smb_bcc      min = 2                           new file pathname
  2121.  smb_buf[]    ASCII -- 04
  2122.               directory pathname
  2123. __________________________________________________________________
  2124.  
  2125.  
  2126.  
  2127. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  2128.  
  2129.  
  2130.  
  2131.  
  2132. File Sharing Protocol      - 27 -           November 7, 1988
  2133.  
  2134.  
  2135. |
  2136. |
  2137. |
  2138. |
  2139. |
  2140. |
  2141. |
  2142. |
  2143. |
  2144. |
  2145. |
  2146. |
  2147. |
  2148. |
  2149. |
  2150. |
  2151. |
  2152. |
  2153. |
  2154. |
  2155. |
  2156. |
  2157. |
  2158. |
  2159. |
  2160. |
  2161. |
  2162. |
  2163. |
  2164. |
  2165. |
  2166. |
  2167. |
  2168. |
  2169. |
  2170. |
  2171. |
  2172. |
  2173. |
  2174. |
  2175. |
  2176. |
  2177. |
  2178.                                  |||||||||||||||||||||||||||||||||||||||||||
  2179.                                                                   |||||||||||||||||||||||||||||||||||||||||||
  2180. The server creates a data file in the directory specified in
  2181. the  request  message  and assigns a unique name to it.  The
  2182. file's name is returned  to  the  requester.   The  file  is
  2183. opened  in compatibility mode with read/write access for the
  2184. requester.
  2185.  
  2186. Unprotected servers will require requesters to  have  create
  2187. permission  for  the subtree containing the file.  The newly
  2188. created file will be opened in compatibility mode  with  the
  2189. access  mode  determined  by  the containing subtree permis-
  2190. sions.
  2191.  
  2192. Protected servers will require requesters to have write per-
  2193. mission  on the file's parent directory.  The access permis-
  2194. sions granted on a created file will be  read/write  permis-
  2195. sion  for  the creator.  The newly created or truncated file
  2196. is opened in read/write/compatibility mode.
  2197.  
  2198. Support of the  create  time  supplied  in  the  request  is
  2199. optional.
  2200.  
  2201. Create Temporary File may generate the following errors.
  2202.  
  2203.         Error Class ERRDOS:
  2204.  
  2205.           ERRbadpath
  2206.           ERRnofids
  2207.           ERRnoaccess
  2208.  
  2209.  
  2210.         Error Class ERRSRV:
  2211.  
  2212.           ERRerror
  2213.           ERRaccess
  2214.           ERRinvnid
  2215.           ERRinvdevice
  2216.           <implementation specific>
  2217.  
  2218.  
  2219.         Error Class ERRHRD:
  2220.  
  2221.           <implementation specific>
  2222.  
  2223.  
  2224. _5._1_7.  _P_r_o_c_e_s_s _E_x_i_t
  2225.  
  2226.  
  2227.           _______________________________________
  2228.            >From Consumer      To Consumer
  2229.           _______________________________________
  2230.            smb_com   SMBexit   smb_com   SMBexit
  2231.            smb_wct   0         smb_wct   0
  2232.            smb_bcc   0         smb_bcc   0
  2233.  
  2234.  
  2235.  
  2236. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242. File Sharing Protocol      - 28 -           November 7, 1988
  2243.  
  2244.  
  2245.           _______________________________________
  2246.           |
  2247.                              |
  2248.                                                  |
  2249.  
  2250. This command informs the server that a consumer process  has
  2251. terminated.   The  server will close all files opened by the
  2252. named process.  This will automatically  release  all  locks
  2253. the  process  holds.  Note that there is not a start process
  2254. message, process-ids are assigned by the consumer.
  2255.  
  2256. Process Exit may generate the following errors:
  2257.  
  2258.         Error Class ERRDOS:
  2259.  
  2260.           none
  2261.  
  2262.  
  2263.         Error Class ERRSRV:
  2264.  
  2265.           ERRerror
  2266.           ERRinvnid
  2267.           <implementation specific>
  2268.  
  2269.  
  2270.         Error Class ERRHRD:
  2271.  
  2272.           <implementation specific>
  2273.  
  2274.  
  2275. _5._1_8.  _M_a_k_e _N_e_w _F_i_l_e
  2276.  
  2277.  
  2278.   _______________________________________________________
  2279.    >From Consumer               To Consumer
  2280.   _______________________________________________________
  2281.    smb_com      SMBmknew        smb_com      SMBmknew
  2282.    smb_wct      3               smb_wct      1
  2283.    smb_vwv[0]   attribute       smb_vwv[0]   file handle
  2284.    smb_vwv[1]   time low        smb_bcc      0
  2285.    smb_vwv[2]   time high
  2286.    smb_bcc      min = 2
  2287.    smb_buf[]    ASCII -- 04
  2288.                 file pathname
  2289.   _______________________________________________________
  2290.   ||||||||||
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.                               ||||||||||
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.                                                          ||||||||||
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.  
  2318.  
  2319. The make new file message is sent to create a new data file.
  2320. It  is functionally equivalent to the create message, except
  2321. it will always fail if the file already exists.
  2322.  
  2323. Make New File may generate the following errors:
  2324.  
  2325.         Error Class ERRDOS:
  2326.  
  2327.           ERRbadpath
  2328.           ERRnofids
  2329.           ERRnoaccess
  2330.           <implementation specific>
  2331.  
  2332.  
  2333.  
  2334.  
  2335. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  2336.  
  2337.  
  2338.  
  2339.  
  2340.  
  2341. File Sharing Protocol      - 29 -           November 7, 1988
  2342.  
  2343.  
  2344.  
  2345.         Error Class ERRSRV:
  2346.  
  2347.           ERRerror
  2348.           ERRaccess
  2349.           ERRinvnid
  2350.           <implementation specific>
  2351.  
  2352.  
  2353.         Error Class ERRHRD:
  2354.  
  2355.           <implementation specific>
  2356.  
  2357.  
  2358. _5._1_9.  _C_h_e_c_k _P_a_t_h
  2359.  
  2360.  
  2361.     ___________________________________________________
  2362.      >From Consumer               To Consumer
  2363.     ___________________________________________________
  2364.      smb_com     SMBchkpath       smb_com   SMBchkpath
  2365.      smb_wct     0                smb_wct   0
  2366.      smb_bcc     min = 2          smb_bcc   0
  2367.      smb_buf[]   ASCII -- 04
  2368.                  directory path
  2369.     ___________________________________________________
  2370.     |||||||
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.                                 |||||||
  2377.  
  2378.  
  2379.  
  2380.  
  2381.  
  2382.                                                        |||||||
  2383.  
  2384.  
  2385.  
  2386.  
  2387.  
  2388.  
  2389.  
  2390. The check path message is used to verify that a path  exists
  2391. and  is a directory.  No error is returned if the given path
  2392. exists and the requester has read access  to  it.   Consumer
  2393. machines  which  maintain a concept of a "working directory"
  2394. will find this useful to verify the validity  of  a  "change
  2395. working  directory"  command.  Note  that the servers do NOT
  2396. have a concept  of  working  directory.  The  consumer  must
  2397. always supply full pathnames (relative to the tid).
  2398.  
  2399. Check Path may generate the following errors:
  2400.  
  2401.         Error Class ERRDOS:
  2402.  
  2403.           ERRbadpath
  2404.           ERRnoaccess
  2405.  
  2406.  
  2407.         Error Class ERRSRV:
  2408.  
  2409.           ERRerror
  2410.           ERRaccess
  2411.           ERRinvnid
  2412.           <implementation specific>
  2413.  
  2414.  
  2415.         Error Class ERRHRD:
  2416.  
  2417.           <implementation specific>
  2418.  
  2419.  
  2420. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426. File Sharing Protocol      - 30 -           November 7, 1988
  2427.  
  2428.  
  2429. _5._2_0.  _G_e_t _S_e_r_v_e_r _A_t_t_r_i_b_u_t_e_s
  2430.  
  2431.  
  2432. ______________________________________________________________________
  2433.  >From Consumer         To Consumer
  2434. ______________________________________________________________________
  2435.  smb_com   SMBdskattr   smb_com      SMBdskattr
  2436.  smb_wct   0            smb_wct      5
  2437.  smb_bcc   0            smb_vwv[0]   # allocation units/server
  2438.                         smb_vwv[1]   # blocks/allocation unit
  2439.                         smb_vwv[2]   # block size (in bytes)
  2440.                         smb_vwv[3]   # free allocation units
  2441.                         smb_vwv[4]   reserved (media identifier code)
  2442.                         smb_bcc      0
  2443. ______________________________________________________________________
  2444. ||||||||||
  2445.  
  2446.  
  2447.  
  2448.  
  2449.  
  2450.  
  2451.  
  2452.  
  2453.                       ||||||||||
  2454.  
  2455.  
  2456.  
  2457.  
  2458.  
  2459.  
  2460.  
  2461.  
  2462.                                                                       ||||||||||
  2463.  
  2464.  
  2465.  
  2466.  
  2467.  
  2468.  
  2469.  
  2470.  
  2471.  
  2472.  
  2473. This command is used to determine the total server  capacity
  2474. and  remaining  free space.  The distinction between alloca-
  2475. tion units and disk blocks allows the use  of  the  protocol
  2476. with  operating  systems  which allocate disk space in units
  2477. larger than the physical disk block.
  2478.  
  2479. The blocking/allocation units used in this response  may  be
  2480. independent    of    the    actual   physical   or   logical
  2481. blocking/allocation  algorithm(s)  used  internally  by  the
  2482. server.  However, they must accurately reflect the amount of
  2483. space on the server.
  2484.  
  2485. The default value for smb_vwv[4] is zero.
  2486.  
  2487. Get Server Attributes may generate the following errors:
  2488.  
  2489.         Error Class ERRDOS:
  2490.  
  2491.           <implementation specific>
  2492.  
  2493.  
  2494.         Error Class ERRSRV:
  2495.  
  2496.           ERRerror
  2497.           ERRinvnid
  2498.           <implementation specific>
  2499.  
  2500.  
  2501.         Error Class ERRHRD:
  2502.  
  2503.           <implementation specific>
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.  
  2513.  
  2514. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  2515.  
  2516.  
  2517.  
  2518.  
  2519.  
  2520. File Sharing Protocol      - 31 -           November 7, 1988
  2521.  
  2522.  
  2523. _5._2_1.  _N_e_g_o_t_i_a_t_e _P_r_o_t_o_c_o_l
  2524.  
  2525.  
  2526.    _____________________________________________________
  2527.     >From Consumer              To Consumer
  2528.    _____________________________________________________
  2529.     smb_com     SMBnegprot      smb_com      SMBnegprot
  2530.     smb_wct     0               smb_wct      1
  2531.     smb_bcc     min = 2         smb_vwv[0]   index
  2532.     smb_buf[]   Dialect -- 02   smb_bcc      0
  2533.                 dialect0
  2534.                   .
  2535.                   .
  2536.                 Dialect -- 02
  2537.                 dialectn
  2538.    _____________________________________________________
  2539.    |||||||||||
  2540.  
  2541.  
  2542.  
  2543.  
  2544.  
  2545.  
  2546.  
  2547.  
  2548.  
  2549.                               |||||||||||
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.                                                         |||||||||||
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571. The consumer sends a list of dialects that he  can  communi-
  2572. cate  with.   The  response  is  a selection of one of those
  2573. dialects (numbered 0 through n) or -1 (hex FFFF)  indicating
  2574. that  none  of  the dialects were acceptable.  The negotiate
  2575. message is binding on the virtual circuit and must be  sent.
  2576. One  and  only one negotiate message may be sent, subsequent
  2577. negotiate requests will be rejected with an  error  response
  2578. and no action will be taken.
  2579.  
  2580. The protocol does not impose any particular structure to the
  2581. dialect  strings.   Implementors of particular protocols may
  2582. choose to include,  for  example,  version  numbers  in  the
  2583. string.
  2584.  
  2585. The dialect string for the protocol specified in this  docu-
  2586. ment is:
  2587.  
  2588.         PC NETWORK PROGRAM 1.0
  2589.  
  2590.  
  2591. Negotiate may generate the following errors:
  2592.  
  2593.         Error Class ERRDOS:
  2594.  
  2595.           <implementation specific>
  2596.  
  2597.  
  2598.         Error Class ERRSRV:
  2599.  
  2600.           ERRerror
  2601.           <implementation specific>
  2602.  
  2603.  
  2604.         Error Class ERRHRD:
  2605.  
  2606.           <implementation specific>
  2607.  
  2608.  
  2609.  
  2610.  
  2611. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  2612.  
  2613.  
  2614.  
  2615.  
  2616.  
  2617. File Sharing Protocol      - 32 -           November 7, 1988
  2618.  
  2619.  
  2620. _5._2_2.  _F_i_l_e _S_e_a_r_c_h
  2621.  
  2622.  
  2623. _______________________________________________________________________
  2624.  >From Consumer                      To Consumer
  2625. _______________________________________________________________________
  2626.  smb_com      SMBsearch              smb_com      SMBsearch
  2627.  smb_wct      2                      smb_wct      1
  2628.  smb_vwv[0]   max-count              smb_vwv[0]   count-returned
  2629.  smb_vwv[1]   attribute              smb_bcc      min = 3
  2630.  smb_bcc      min = 5                smb_buf[]    Variable block -- 05
  2631.  smb_buf[]    ASCII -- 04                         length of data
  2632.               file pathname                       directory entries
  2633.               Variable block -- 05
  2634.               length of data
  2635.               search status
  2636. _______________________________________________________________________
  2637. ||||||||||||
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.  
  2645.  
  2646.  
  2647.  
  2648.                                    ||||||||||||
  2649.  
  2650.  
  2651.  
  2652.  
  2653.  
  2654.  
  2655.  
  2656.  
  2657.  
  2658.  
  2659.                                                                        ||||||||||||
  2660.  
  2661.  
  2662.  
  2663.  
  2664.  
  2665.  
  2666.  
  2667.  
  2668.  
  2669.  
  2670.  
  2671.  
  2672. This command is used to search directories.  The  file  path
  2673. name  in  the  request specifies the file to be sought.  The
  2674. attribute field indicates the attributes that the file  must
  2675. have.   If  the attribute is zero then only normal files are
  2676. returned.  If the system file, hidden  or  directory  attri-
  2677. butes are specified then the search is inclusive -- both the
  2678. specified type(s) of files and normal  files  are  returned.
  2679. If  the  volume label attribute is specified then the search
  2680. is exclusive, and only the volume label entry is returned
  2681.  
  2682. The  max-count  field  specifies  the  number  of  directory
  2683. entries  to  be  returned.  The response will contain one or
  2684. more directory entries as determined by  the  count-returned
  2685. field.   No  more  than  max-count entries will be returned.
  2686. Only entries that match the sought  filename/attribute  will
  2687. be returned.
  2688.  
  2689. The search-status field must be null (length  =  0)  on  the
  2690. initial search request.  Subsequent search requests intended
  2691. to continue a search must contain  the  search-status  field
  2692. extracted  from  the  last  directory  entry of the previous
  2693. response.  The search-status field is self-contained, for on
  2694. calls  containing  a  search-status neither the attribute or
  2695. pathname fields will be valid in the request.  Search-status
  2696. has the following format:
  2697.  
  2698.  
  2699.   BYTE   sr_res;         /* reserved:
  2700.                            bit    7 - reserved for consumer use
  2701.                            bit  5,6 - reserved for system use (must be preserved)
  2702.                            bits 0-4 - reserved for server (must be preserved) */
  2703.   BYTE   sr_name[11];    /* pathname sought.  Format:
  2704.                            0-3 character extension, left justified (in last 3 chars) */
  2705.   BYTE   sr_server[5];   /* available for server use (1st byte must be non-zero) */
  2706.   BYTE   sr_res[4];      /* reserved for consumer use */
  2707.  
  2708.  
  2709. A  File  Search  request  will  terminate  when  either  the
  2710.  
  2711.  
  2712. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  2713.  
  2714.  
  2715.  
  2716.  
  2717.  
  2718. File Sharing Protocol      - 33 -           November 7, 1988
  2719.  
  2720.  
  2721. requested  maximum  number  of  entries that match the named
  2722. file are found, or the end of directory is  reached  without
  2723. the  maximum number of matches being found.  A response con-
  2724. taining no entries indicates that no matching  entries  were
  2725. found  between  the starting point of the search and the end
  2726. of directory.
  2727.  
  2728. There may be multiple matching entries in response to a sin-
  2729. gle request as File Search supports "wild cards" in the file
  2730. name (last component of the pathname).  The wild card match-
  2731. ing algorithm is described in the "Delete File" description.
  2732.  
  2733. Unprotected servers require the requester to have read  per-
  2734. mission on the subtree containing the directory searched.
  2735.  
  2736. Protected servers require the requester to have read permis-
  2737. sion on the directory searched.
  2738.  
  2739. If a File Search requests more data than can be placed in  a
  2740. message  of  the  max-xmit-size  for  the TID specified, the
  2741. server will abort the virtual circuit to the consumer.
  2742.  
  2743. dir_info entries have the following format.
  2744.  
  2745. BYTE   find_buf_reserved[21];   /* reserved (search_status) */
  2746. BYTE   find_buf_attr;           /* attribute */
  2747. WORD   find_buf_time;           /* modification time (hhhhh mmmmmm xxxxx)
  2748.                                 where 'xxxxx' is in two second increments */
  2749. WORD   find_buf_date;           /* modification date (yyyyyyy mmmm ddddd) */
  2750. WORD   find_buf_size_l;         /* file size -- low word */
  2751. WORD   find_buf_size_h;         /* file size -- high word */
  2752. BYTE   find_buf_pname[13];      /* file name -- ASCII (null terminated) */
  2753.  
  2754. File Search may generate the following errors:
  2755.  
  2756.         Error Class ERRDOS:
  2757.  
  2758.           ERRnofiles
  2759.  
  2760.  
  2761.         Error Class ERRSRV:
  2762.  
  2763.           ERRerror
  2764.           ERRaccess
  2765.           ERRinvnid
  2766.           <implementation specific>
  2767.  
  2768.  
  2769.         Error Class ERRHRD:
  2770.  
  2771.           <implementation specific>
  2772.  
  2773.  
  2774.  
  2775.  
  2776.  
  2777.  
  2778. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  2779.  
  2780.  
  2781.  
  2782.  
  2783.  
  2784. File Sharing Protocol      - 34 -           November 7, 1988
  2785.  
  2786.  
  2787. _5._2_3.  _C_r_e_a_t_e _P_r_i_n_t _F_i_l_e
  2788.  
  2789.  
  2790. ______________________________________________________________________
  2791.  >From Consumer                              To Consumer
  2792. ______________________________________________________________________
  2793.  smb_com      SMBsplopen                     smb_com      SMBsplopen
  2794.  smb_wct      2                              smb_wct      1
  2795.  smb_vwv[0]   length of printer setup data   smb_vwv[0]   file handle
  2796.  smb_vwv[1]   mode                           smb_bcc      0
  2797.  smb_bcc      min = 2
  2798.  smb_buf      ASCII -- 04
  2799.               identifier string (max 15)
  2800. ______________________________________________________________________
  2801. |||||||||
  2802.  
  2803.  
  2804.  
  2805.  
  2806.  
  2807.  
  2808.  
  2809.                                            |||||||||
  2810.  
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.                                                                       |||||||||
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827. This message is sent to create a new printer file.  The file
  2828. handle  returned  can be used for subsequent write and close
  2829. commands.  The file name will be formed by concatenating the
  2830. identifier  string  and a server generated number.  The file
  2831. will be deleted once it has been printed.
  2832.  
  2833. The mode field can have the following values:
  2834.  
  2835. 0 =   Text mode.  (DOS servers will expand TABs.)
  2836. 1 =   Graphics mode.
  2837.  
  2838.  
  2839. Protected servers grant write permission to the  creator  of
  2840. the  file.   No other users will be given any permissions to
  2841. the file.  All users will have read permission to the  print
  2842. queue, but only the print server has write permission to it.
  2843.  
  2844. Create Print File may generate the following errors:
  2845.  
  2846.         Error Class ERRDOS:
  2847.  
  2848.           ERRbadpath
  2849.           ERRnofids
  2850.           ERRnoaccess
  2851.           <implementation specific>
  2852.  
  2853.  
  2854.         Error Class ERRSRV:
  2855.  
  2856.           ERRerror
  2857.           ERRqfull
  2858.           ERRqtoobig
  2859.           ERRinvnid
  2860.           <implementation specific>
  2861.  
  2862.  
  2863.         Error Class ERRHRD:
  2864.  
  2865.           <implementation specific>
  2866.  
  2867.  
  2868.  
  2869. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  2870.  
  2871.  
  2872.  
  2873.  
  2874.  
  2875. File Sharing Protocol      - 35 -           November 7, 1988
  2876.  
  2877.  
  2878. _5._2_4.  _C_l_o_s_e _P_r_i_n_t _F_i_l_e
  2879.  
  2880.  
  2881.      __________________________________________________
  2882.       >From Consumer             To Consumer
  2883.      __________________________________________________
  2884.       smb_com      SMBsplclose   smb_com   SMBsplclose
  2885.       smb_wct      1             smb_wct   0
  2886.       smb_vwv[0]   file handle   smb_bcc   0
  2887.       smb_bcc      0
  2888.      __________________________________________________
  2889.      ||||||
  2890.  
  2891.  
  2892.  
  2893.  
  2894.                                ||||||
  2895.  
  2896.  
  2897.  
  2898.  
  2899.                                                        ||||||
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906. This message  invalidates  the  specified  file  handle  and
  2907. queues  the  file for printing.  The file handle must refer-
  2908. ence a print file.
  2909.  
  2910. Close Print File may generate the following errors:
  2911.  
  2912.         Error Class ERRDOS:
  2913.  
  2914.           ERRbadfid
  2915.           <implementation specific>
  2916.  
  2917.  
  2918.         Error Class ERRSRV:
  2919.  
  2920.           ERRerror
  2921.           ERRinvdevice
  2922.           ERRqtoobig
  2923.           ERRinvnid
  2924.           <implementation specific>
  2925.  
  2926.  
  2927.         Error Class ERRHRD:
  2928.  
  2929.           <implementation specific>
  2930.  
  2931.  
  2932. _5._2_5.  _W_r_i_t_e _P_r_i_n_t _F_i_l_e
  2933.  
  2934.  
  2935.     ____________________________________________________
  2936.      >From Consumer                  To Consumer
  2937.     ____________________________________________________
  2938.      smb_com      SMBsplwr           smb_com   SMBsplwr
  2939.      smb_wct      1                  smb_wct   0
  2940.      smb_vwv[0]   file handle        smb_bcc   0
  2941.      smb_bcc      min = 4
  2942.      smb_buf      Data block -- 01
  2943.                   length of data
  2944.                   data
  2945.     ____________________________________________________
  2946.     |||||||||
  2947.  
  2948.  
  2949.  
  2950.  
  2951.  
  2952.  
  2953.  
  2954.                                    |||||||||
  2955.  
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.                                                         |||||||||
  2963.  
  2964.  
  2965.  
  2966.  
  2967.  
  2968.  
  2969.  
  2970.  
  2971.  
  2972. This message appends the data block to the print file speci-
  2973. fied  by  the file handle.  The file handle must reference a
  2974. print file.  The first block sent to a print file must  con-
  2975. tain  the  printer  setup  data.  The length of this data is
  2976.  
  2977.  
  2978.  
  2979. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  2980.  
  2981.  
  2982.  
  2983.  
  2984.  
  2985. File Sharing Protocol      - 36 -           November 7, 1988
  2986.  
  2987.  
  2988. specified in the Create Print File request.
  2989.  
  2990. If a Write Print File sends a message of length greater than
  2991. the  max-xmit-size  for  the  TID specified, the server will
  2992. abort the virtual circuit to the consumer.
  2993.  
  2994. Write Print File may generate the following errors:
  2995.  
  2996.         Error Class ERRDOS:
  2997.  
  2998.           ERRbadfid
  2999.           ERRnoaccess
  3000.           <implementation specific>
  3001.  
  3002.  
  3003.         Error Class ERRSRV:
  3004.  
  3005.           ERRerror
  3006.           ERRinvdevice
  3007.           ERRqtoobig
  3008.           ERRinvnid
  3009.           <implementation specific>
  3010.  
  3011.  
  3012.         Error Class ERRHRD:
  3013.  
  3014.           <implementation specific>
  3015.  
  3016.  
  3017. _5._2_6.  _G_e_t _P_r_i_n_t _Q_u_e_u_e
  3018.  
  3019.  
  3020.  __________________________________________________________
  3021.   >From Consumer             To Consumer
  3022.  __________________________________________________________
  3023.   smb_com      SMBsplretq    smb_com      SMBsplretq
  3024.   smb_wct      2             smb_wct      2
  3025.   smb_vwv[0]   max_count     smb_vwv[0]   count
  3026.   smb_vwv[1]   start index   smb_vwv[1]   restart index
  3027.   smb_bcc      0             smb_bcc      min = 3
  3028.                              smb_buf      Data block -- 01
  3029.                                           length of data
  3030.                                           queue elements
  3031.  __________________________________________________________
  3032.  ||||||||||
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.  
  3041.                            ||||||||||
  3042.  
  3043.  
  3044.  
  3045.  
  3046.  
  3047.  
  3048.  
  3049.  
  3050.                                                            ||||||||||
  3051.  
  3052.  
  3053.  
  3054.  
  3055.  
  3056.  
  3057.  
  3058.  
  3059.  
  3060.  
  3061. This message obtains a list of the elements currently in the
  3062. print  queue  on  the  server.   "start index" specifies the
  3063. first entry in the queue to  return,  "max_count"  specifies
  3064. the maximum number of entries to return, this may be a posi-
  3065. tive or negative number.  A positive number requests a  for-
  3066. ward  search, a negative number indicates a backward search.
  3067. In the response "count"  indicates  how  many  entries  were
  3068. actually returned. "Restart index" is the index of the entry
  3069. following the last entry returned; it may  be  used  as  the
  3070. start  index  in  a  subsequent  request to resume the queue
  3071. listing.
  3072.  
  3073.  
  3074. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  3075.  
  3076.  
  3077.  
  3078.  
  3079.  
  3080. File Sharing Protocol      - 37 -           November 7, 1988
  3081.  
  3082.  
  3083. Get Print Queue will return less than the  requested  number
  3084. of elements only when the top or end of the queue is encoun-
  3085. tered
  3086.  
  3087. The format of the queue elements returned is:
  3088.  
  3089. smb_date     WORD       file date (yyyyyyy mmmm ddddd)
  3090. smb_time     WORD       file time (hhhhh mmmmmm xxxxx)
  3091.                         where 'xxxxx' is in 2 second increments
  3092. smb_status   BYTE       entry status
  3093.                         01 = held or stopped
  3094.                         02 = printing
  3095.                         03 = awaiting print
  3096.                         04 = in intercept
  3097.                         05 = file had error
  3098.                         06 = printer error
  3099.                         07-FF = reserved
  3100. smb_file     WORD       spool file number (from create print file request)
  3101. smb_sizelo   WORD       low word of file size
  3102. smb_sizehi   WORD       high word of file size
  3103. smb_res      BYTE       reserved
  3104. smb_name     BYTE[16]   originator name (from create print file request)
  3105.  
  3106.  
  3107. Get Print Queue may generate the following errors:
  3108.  
  3109.         Error Class ERRDOS:
  3110.  
  3111.           <implementation specific>
  3112.  
  3113.  
  3114.         Error Class ERRSRV:
  3115.  
  3116.           ERRerror
  3117.           ERRqeof
  3118.           ERRinvnid
  3119.           <implementation specific>
  3120.  
  3121.  
  3122.         Error Class ERRHRD:
  3123.  
  3124.           <implementation specific>
  3125.  
  3126.  
  3127.  
  3128.  
  3129.  
  3130.  
  3131.  
  3132.  
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138.  
  3139.  
  3140. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  3141.  
  3142.  
  3143.  
  3144.  
  3145.  
  3146. File Sharing Protocol      - 38 -           November 7, 1988
  3147.  
  3148.  
  3149. _6.  _M_e_s_s_a_g_e _C_o_m_m_a_n_d_s
  3150.  
  3151. These commands provide a  message  delivery  system  between
  3152. users  of systems participating in the network.  The message
  3153. commands cannot use VCs established  for  the  file  sharing
  3154. commands.   A  separate  VC, dedicated to messaging, must be
  3155. established.
  3156.  
  3157. Messaging services should support  message  forwarding.   By
  3158. convention  user names used for message delivery have a suf-
  3159. fix (in byte 16) of "03", forwarded names have a  suffix  of
  3160. "05". The algorithm for sending messages is to first attempt
  3161. to deliver the message to the forwarded name,  and  only  if
  3162. this fails to attempt to deliver to the normal name.
  3163.  
  3164. _6._1.  _S_e_n_d _S_i_n_g_l_e _B_l_o_c_k _M_e_s_s_a_g_e
  3165.  
  3166.  
  3167. __________________________________________________________________
  3168.  >From Consumer                                To Consumer
  3169. __________________________________________________________________
  3170.  smb_com     SMBsends                          smb_com   SMBsends
  3171.  smb_wct     0                                 smb_wct   0
  3172.  smb_bcc     min = 7                           smb_bcc   0
  3173.  smb_buf[]   ASCII -- 04
  3174.              originator name (max 15 bytes)
  3175.              ASCII -- 04
  3176.              destination name (max 15 bytes)
  3177.              Data Block -- 01
  3178.              length of message (max 128)
  3179.              message (max 128 bytes)
  3180. __________________________________________________________________
  3181. ||||||||||||
  3182.  
  3183.  
  3184.  
  3185.  
  3186.  
  3187.  
  3188.  
  3189.  
  3190.  
  3191.  
  3192.                                              ||||||||||||
  3193.  
  3194.  
  3195.  
  3196.  
  3197.  
  3198.  
  3199.  
  3200.  
  3201.  
  3202.  
  3203.                                                                   ||||||||||||
  3204.  
  3205.  
  3206.  
  3207.  
  3208.  
  3209.  
  3210.  
  3211.  
  3212.  
  3213.  
  3214.  
  3215.  
  3216.  
  3217. Send Single Block Message sends a short message (up  to  128
  3218. bytes in length) to a single destination (user).
  3219.  
  3220. The names specified in this message do not include  the  one
  3221. byte suffix ("03" or "05").
  3222.  
  3223. Send Single Block Message may generate the following errors.
  3224.  
  3225.         Error Class ERRDOS:
  3226.  
  3227.           <implementation specific>
  3228.  
  3229.  
  3230.         Error Class ERRSRV:
  3231.  
  3232.           ERRerror
  3233.           ERRinvnid
  3234.           ERRpaused
  3235.           ERRmsgoff
  3236.           ERRnoroom
  3237.           <implementation specific>
  3238.  
  3239.  
  3240. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  3241.  
  3242.  
  3243.  
  3244.  
  3245.  
  3246. File Sharing Protocol      - 39 -           November 7, 1988
  3247.  
  3248.  
  3249.  
  3250.         Error Class ERRHRD:
  3251.  
  3252.           <implementation specific>
  3253.  
  3254.  
  3255. _6._2.  _S_e_n_d _B_r_o_a_d_c_a_s_t _M_e_s_s_a_g_e
  3256.  
  3257.  
  3258. _____________________________________________________________
  3259.  >From Consumer                               To Consumer
  3260. _____________________________________________________________
  3261.  smb_com     SMBsendb                         No Response
  3262.  smb_wct     0
  3263.  smb_bcc     min = 8
  3264.  smb_buf[]   ASCII -- 04
  3265.              originator name (max 15 bytes)
  3266.              ASCII -- 04
  3267.              "*"
  3268.              Data Block -- 01
  3269.              length of message (max 128)
  3270.              message (max 128 bytes)
  3271. _____________________________________________________________
  3272. ||||||||||||
  3273.  
  3274.  
  3275.  
  3276.  
  3277.  
  3278.  
  3279.  
  3280.  
  3281.  
  3282.  
  3283.                                             ||||||||||||
  3284.  
  3285.  
  3286.  
  3287.  
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.                                                              ||||||||||||
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.  
  3305.  
  3306.  
  3307. Send Broadcast Message sends a  short  message  (up  to  128
  3308. bytes in length) to every user in the network.
  3309.  
  3310. The name specified in this message does not include the  one
  3311. byte suffix ("03").
  3312.  
  3313. There is no response message  to  this  command,  thus  Send
  3314. Broadcast Message cannot generate errors.
  3315.  
  3316. _6._3.  _S_e_n_d _S_t_a_r_t _o_f _M_u_l_t_i-_b_l_o_c_k _M_e_s_s_a_g_e
  3317.  
  3318.  
  3319. __________________________________________________________________________
  3320.  >From Consumer                                To Consumer
  3321. __________________________________________________________________________
  3322.  smb_com     SMBsendstrt                       smb_com   SMBsendstrt
  3323.  smb_wct     0                                 smb_wct   1
  3324.  smb_bcc     min = 0                           smb_vwv   message group ID
  3325.  smb_buf[]   ASCII -- 04                       smb_bcc   0
  3326.              originator name (max 15 bytes)
  3327.              ASCII -- 04
  3328.              destination name (max 15 bytes)
  3329. __________________________________________________________________________
  3330. |||||||||
  3331.  
  3332.  
  3333.  
  3334.  
  3335.  
  3336.  
  3337.  
  3338.                                              |||||||||
  3339.  
  3340.  
  3341.  
  3342.  
  3343.  
  3344.  
  3345.  
  3346.                                                                           |||||||||
  3347.  
  3348.  
  3349.  
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.  
  3356. This command informs the server that a  multi-block  message
  3357. will  be  sent.  The server returns a message group ID to be
  3358. used to identify the message blocks when they are sent.
  3359.  
  3360. The names specified in this message do not include  the  one
  3361. byte suffix ("03" or "05").
  3362.  
  3363. Send Start of Multi-block Message may generate the following
  3364. errors.
  3365.  
  3366.  
  3367.  
  3368. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  3369.  
  3370.  
  3371.  
  3372.  
  3373.  
  3374. File Sharing Protocol      - 40 -           November 7, 1988
  3375.  
  3376.  
  3377.  
  3378.         Error Class ERRDOS:
  3379.  
  3380.           <implementation specific>
  3381.  
  3382.  
  3383.         Error Class ERRSRV:
  3384.  
  3385.           ERRerror
  3386.           ERRinvnid
  3387.           ERRpaused
  3388.           ERRmsgoff
  3389.           ERRnoroom
  3390.           <implementation specific>
  3391.  
  3392.  
  3393.         Error Class ERRHRD:
  3394.  
  3395.           <implementation specific>
  3396.  
  3397.  
  3398. _6._4.  _S_e_n_d _T_e_x_t _o_f _M_u_l_t_i-_b_l_o_c_k _M_e_s_s_a_g_e
  3399.  
  3400.  
  3401. ________________________________________________________________
  3402.  >From Consumer                            To Consumer
  3403. ________________________________________________________________
  3404.  smb_com     SMBsendtxt                    smb_com   SMBsendtxt
  3405.  smb_wct     1                             smb_wct   0
  3406.  smb_vwv     message group ID              smb_bcc   0
  3407.  smb_bcc     min = 3
  3408.  smb_buf[]   Data Block -- 01
  3409.              length of message (max 128)
  3410.              message (max 128 bytes)
  3411. ________________________________________________________________
  3412. |||||||||
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418.  
  3419.  
  3420.                                          |||||||||
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.                                                                 |||||||||
  3429.  
  3430.  
  3431.  
  3432.  
  3433.  
  3434.  
  3435.  
  3436.  
  3437.  
  3438. This command delivers a segment of a multi-block message  to
  3439. the  server.   It  must  contain  a  valid  message group ID
  3440. returned by an earlier Start Multi-block Message command.
  3441.  
  3442. A maximum of 128 bytes of message may be sent with this com-
  3443. mand.   A  multi-block  message  cannot exceed 1600 bytes in
  3444. total length (sum of all segments sent with a given  message
  3445. group ID).
  3446.  
  3447. Send Text of Multi-block Message may generate the  following
  3448. errors.
  3449.  
  3450.         Error Class ERRDOS:
  3451.  
  3452.           <implementation specific>
  3453.  
  3454.  
  3455.  
  3456.  
  3457.  
  3458.  
  3459. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  3460.  
  3461.  
  3462.  
  3463.  
  3464.  
  3465. File Sharing Protocol      - 41 -           November 7, 1988
  3466.  
  3467.  
  3468.  
  3469.         Error Class ERRSRV:
  3470.  
  3471.           ERRerror
  3472.           ERRinvnid
  3473.           ERRpaused
  3474.           ERRmsgoff
  3475.           ERRnoroom
  3476.           <implementation specific>
  3477.  
  3478.  
  3479.         Error Class ERRHRD:
  3480.  
  3481.           <implementation specific>
  3482.  
  3483.  
  3484. _6._5.  _S_e_n_d _E_n_d _o_f _M_u_l_t_i-_b_l_o_c_k _M_e_s_s_a_g_e
  3485.  
  3486.  
  3487.     ___________________________________________________
  3488.      >From Consumer               To Consumer
  3489.     ___________________________________________________
  3490.      smb_com   SMBsendend         smb_com   SMBsendend
  3491.      smb_wct   0                  smb_wct   0
  3492.      smb_vwv   message group ID   smb_bcc   0
  3493.      smb_bcc   0
  3494.     ___________________________________________________
  3495.     ||||||
  3496.  
  3497.  
  3498.  
  3499.  
  3500.                                 ||||||
  3501.  
  3502.  
  3503.  
  3504.  
  3505.                                                        ||||||
  3506.  
  3507.  
  3508.  
  3509.  
  3510.  
  3511.  
  3512. This command signals the completion of the multi-block  mes-
  3513. sage identified by the message group ID.
  3514.  
  3515. Send End of Multi-block Message may generate  the  following
  3516. errors.
  3517.  
  3518.         Error Class ERRDOS:
  3519.  
  3520.           <implementation specific>
  3521.  
  3522.  
  3523.         Error Class ERRSRV:
  3524.  
  3525.           ERRerror
  3526.           ERRinvnid
  3527.           ERRpaused
  3528.           ERRmsgoff
  3529.           <implementation specific>
  3530.  
  3531.  
  3532.         Error Class ERRHRD:
  3533.  
  3534.           <implementation specific>
  3535.  
  3536.  
  3537.  
  3538.  
  3539.  
  3540.  
  3541. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  3542.  
  3543.  
  3544.  
  3545.  
  3546.  
  3547. File Sharing Protocol      - 42 -           November 7, 1988
  3548.  
  3549.  
  3550. _6._6.  _F_o_r_w_a_r_d _U_s_e_r _N_a_m_e
  3551.  
  3552.  
  3553. __________________________________________________________________
  3554.  >From Consumer                              To Consumer
  3555. __________________________________________________________________
  3556.  smb_com     SMBfwdname                      smb_com   SMBfwdname
  3557.  smb_wct     0                               smb_wct   0
  3558.  smb_bcc     min = 2                         smb_bcc   0
  3559.  smb_buf[]   ASCII -- 04
  3560.              forwarded name (max 15 bytes)
  3561. __________________________________________________________________
  3562. |||||||
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568.                                            |||||||
  3569.  
  3570.  
  3571.  
  3572.  
  3573.  
  3574.                                                                   |||||||
  3575.  
  3576.  
  3577.  
  3578.  
  3579.  
  3580.  
  3581.  
  3582. This command informs the server that it should  accept  mes-
  3583. sages sent to the forwarded name.
  3584.  
  3585. The name specified in this message does not include the  one
  3586. byte suffix ("03" or "05").
  3587.  
  3588. Forward User Name may generate the following errors.
  3589.  
  3590.         Error Class ERRDOS:
  3591.  
  3592.           <implementation specific>
  3593.  
  3594.  
  3595.         Error Class ERRSRV:
  3596.  
  3597.           ERRerror
  3598.           ERRinvnid
  3599.           ERRrmuns
  3600.           <implementation specific>
  3601.  
  3602.  
  3603.         Error Class ERRHRD:
  3604.  
  3605.           <implementation specific>
  3606.  
  3607.  
  3608. _6._7.  _C_a_n_c_e_l _F_o_r_w_a_r_d
  3609.  
  3610.  
  3611. __________________________________________________________________
  3612.  >From Consumer                              To Consumer
  3613. __________________________________________________________________
  3614.  smb_com     SMBcancelf                      smb_com   SMBcancelf
  3615.  smb_wct     0                               smb_wct   0
  3616.  smb_bcc     min = 2                         smb_bcc   0
  3617.  smb_buf[]   ASCII -- 04
  3618.              forwarded name (max 15 bytes)
  3619. __________________________________________________________________
  3620. |||||||
  3621.  
  3622.  
  3623.  
  3624.  
  3625.  
  3626.                                            |||||||
  3627.  
  3628.  
  3629.  
  3630.  
  3631.  
  3632.                                                                   |||||||
  3633.  
  3634.  
  3635.  
  3636.  
  3637.  
  3638.  
  3639.  
  3640. The Cancel Forward command cancels the  effect  of  a  prior
  3641. Forward  User  Name  command.   The addressed server will no
  3642. longer accept messages for the designated user name.
  3643.  
  3644. The name specified in this message does not include the  one
  3645.  
  3646.  
  3647.  
  3648. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  3649.  
  3650.  
  3651.  
  3652.  
  3653.  
  3654. File Sharing Protocol      - 43 -           November 7, 1988
  3655.  
  3656.  
  3657. byte suffix ("05").
  3658.  
  3659. Cancel Forward may generate the following errors.
  3660.  
  3661.         Error Class ERRDOS:
  3662.  
  3663.           <implementation specific>
  3664.  
  3665.  
  3666.         Error Class ERRSRV:
  3667.  
  3668.           ERRerror
  3669.           ERRinvnid
  3670.           <implementation specific>
  3671.  
  3672.  
  3673.         Error Class ERRHRD:
  3674.  
  3675.           <implementation specific>
  3676.  
  3677.  
  3678. _6._8.  _G_e_t _M_a_c_h_i_n_e _N_a_m_e
  3679.  
  3680.  
  3681. _______________________________________________________________
  3682.  >From Consumer        To Consumer
  3683. _______________________________________________________________
  3684.  smb_com   SMBgetmac   smb_com     SMBgetmac
  3685.  smb_wct   0           smb_wct     0
  3686.  smb_bcc   0           smb_bcc     min = 2
  3687.                        smb_buf[]   ASCII -- 04
  3688.                                    machine name (max 15 bytes)
  3689. _______________________________________________________________
  3690. |||||||
  3691.  
  3692.  
  3693.  
  3694.  
  3695.  
  3696.                      |||||||
  3697.  
  3698.  
  3699.  
  3700.  
  3701.  
  3702.                                                                |||||||
  3703.  
  3704.  
  3705.  
  3706.  
  3707.  
  3708.  
  3709.  
  3710. The Get Machine Name command obtains the machine name of the
  3711. target machine.  It is used prior to the Cancel Forward com-
  3712. mand to determine which machine to send the  Cancel  Forward
  3713. command  to.  Get Machine Name is sent to the forwarded name
  3714. to be canceled, and the server then returns the machine name
  3715. to which the Cancel Forward command must be sent.
  3716.  
  3717. Get Machine Name may return the following errors.
  3718.  
  3719.         Error Class ERRDOS:
  3720.  
  3721.           <implementation specific>
  3722.  
  3723.  
  3724.         Error Class ERRSRV:
  3725.  
  3726.           ERRerror
  3727.           ERRinvnid
  3728.           <implementation specific>
  3729.  
  3730.  
  3731.  
  3732.  
  3733. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  3734.  
  3735.  
  3736.  
  3737.  
  3738.  
  3739. File Sharing Protocol      - 44 -           November 7, 1988
  3740.  
  3741.  
  3742.  
  3743.         Error Class ERRHRD:
  3744.  
  3745.           <implementation specific>
  3746.  
  3747.  
  3748.  
  3749.  
  3750.  
  3751.  
  3752.  
  3753.  
  3754.  
  3755.  
  3756.  
  3757.  
  3758.  
  3759.  
  3760.  
  3761.  
  3762.  
  3763.  
  3764.  
  3765.  
  3766.  
  3767.  
  3768.  
  3769.  
  3770.  
  3771.  
  3772.  
  3773.  
  3774.  
  3775.  
  3776.  
  3777.  
  3778.  
  3779.  
  3780.  
  3781.  
  3782.  
  3783.  
  3784.  
  3785.  
  3786.  
  3787.  
  3788.  
  3789.  
  3790.  
  3791.  
  3792.  
  3793.  
  3794.  
  3795.  
  3796.  
  3797.  
  3798.  
  3799. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  3800.  
  3801.  
  3802.  
  3803.  
  3804.  
  3805. File Sharing Protocol      - 45 -           November 7, 1988
  3806.  
  3807.  
  3808. _7.  _D_a_t_a _D_e_f_i_n_i_t_i_o_n_s
  3809.  
  3810. _7._1.  _M_e_s_s_a_g_e _O_b_j_e_c_t_s
  3811.  
  3812.  
  3813. attribute:The attributes of  the  file.   Portions  of  this
  3814.      field  indicate the type of file.  The rest of the con-
  3815.      tents are server  specific.   The  MS-DOS  server  will
  3816.      return  the  following values in attribute (bit0 is the
  3817.      low order bit):
  3818.  
  3819.              Generic Attributes:
  3820.                bit4    - directory
  3821.  
  3822.              MS-DOS Attributes:
  3823.                bit0      - read only file
  3824.                bit1      - "hidden" file
  3825.                bit2      - system file
  3826.                bit3      - volume id
  3827.                bit5      - archive file
  3828.                bits6-15  - reserved
  3829.  
  3830.      Support of the Generic Attributes is mandatory; support
  3831.      of  the  MS-DOS  Attributes is optional.  If the MS-DOS
  3832.      Attributes are not supported, attempts to set them must
  3833.      be  rejected  and  atempts to match on them (e.g., File
  3834.      Search) must result in a null response.
  3835.  
  3836. count of bytes:The count  of bytes (1 to the  maximum  size)
  3837.      read/written.  The maximum size is server specific.
  3838.  
  3839. count left:The count of bytes not  yet  read/written.   This
  3840.      field  is  advisory  only and is used for read-ahead in
  3841.      the server.
  3842.  
  3843. count-returned:The actual number of directory  entries  that
  3844.      are returned by a file-search response.
  3845.  
  3846. data read/written:The actual data.
  3847.  
  3848. dialect-0-dialect-n:A list of dialects, each of which  iden-
  3849.      tifies  a  requested  protocol and version in a string.
  3850.      Examples: "SNA-REV2" "TEST PROTOCOL" "RING.2"
  3851.  
  3852. dir_info:A data  block  containing  an  array  of  directory
  3853.      entries returned by file search.
  3854.  
  3855. dir pathname:An ASCII string, null terminated, that  defines
  3856.      the  location  of  a file within the tree.  Use the '\'
  3857.      character to separate components.  The  last  component
  3858.      names  a  directory.  The maximum size of this field is
  3859.      server specific.  The pathname is relative to a TID and
  3860.      may or may not commence with a '\'
  3861.  
  3862.  
  3863.  
  3864.  
  3865. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  3866.  
  3867.  
  3868.  
  3869.  
  3870.  
  3871. File Sharing Protocol      - 46 -           November 7, 1988
  3872.  
  3873.  
  3874. file handle:The  file  identifier  obtained  form  an  open,
  3875.      create,  make  new file, and make temp file.  File han-
  3876.      dles are unique within a process id.
  3877.  
  3878. file pathname:An ASCII string, null terminated, that defines
  3879.      the  location  of  a file within the tree.  Use the '\'
  3880.      character to separate components.  The  last  component
  3881.      names a file.  The maximum size of this field is server
  3882.      specific.  The pathname is relative to a TID and may or
  3883.      may not commence with a '\'
  3884.  
  3885. file size low/hi:Low and hi words of  a  32-bit  long  field
  3886.      that represents the Data file size.
  3887.  
  3888. identifier string:The "originator name" of the  owner  of  a
  3889.      print file.  The server will add a number to it to gen-
  3890.      erate a unique file name.  This is  a  null  terminated
  3891.      ASCII string.
  3892.  
  3893. max-count:The maximum number of directory entries  that  can
  3894.      be returned by a file-search response.
  3895.  
  3896. max xmit size:The maximum size message  that  a  server  can
  3897.      handle.
  3898.  
  3899. message group IDA message group  ID  uniquely  identifies  a
  3900.      multi-block message.
  3901.  
  3902. non-owner access:The access rights of other than the owner.
  3903.  
  3904. offset low/hi:The low and hi words of a 32-bit offset.
  3905.  
  3906. owner access:The access rights of the owner.
  3907.  
  3908. owner id:The user id of the owner of the file.
  3909.  
  3910. password:May be used with the pathname for authentication by
  3911.      the  NET  USE command.  This is a null terminated ASCII
  3912.      string.
  3913.  
  3914. r/w/share:This field defines the  file  mode.   It  contains
  3915.      fields that represent the following:
  3916.  
  3917.              Access modes:
  3918.                 Read
  3919.                 Write
  3920.                 Read/Write
  3921.              Sharing modes:
  3922.                 Exclusive
  3923.                 No restriction
  3924.                 Multiple Readers
  3925.                 Multiple Writers
  3926.  
  3927.  
  3928.  
  3929.  
  3930.  
  3931. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  3932.  
  3933.  
  3934.  
  3935.  
  3936.  
  3937. File Sharing Protocol      - 47 -           November 7, 1988
  3938.  
  3939.  
  3940. search-status:A variable block reserved for server  specific
  3941.      information  that  is  passed  from  each  file  search
  3942.      response message to the next file search request.
  3943.  
  3944. time1 low/hi:File modification time.  these two words define
  3945.      a  32  bit  field  that  contains the modification time
  3946.      expressed as seconds past Jan 1 1970 (local time zone).
  3947.      A value of zero indicates a null time field.
  3948.  
  3949. _7._2.  _D_a_t_a _B_u_f_f_e_r _F_o_r_m_a_t_s (_s_m_b__b_u_f)
  3950.  
  3951. The data portion of these messages  typically  contains  the
  3952. data  to be read or written, file paths, or directory paths.
  3953. The format of the data portion depends on the message.   All
  3954. fields  in  the data portion have the same format.  In every
  3955. case it consists of an identifier byte followed by the data.
  3956.  
  3957.   _______________________________________________________
  3958.                    Data Identifier Bytes
  3959.   _______________________________________________________
  3960.    Name             Description                    Value
  3961.   _______________________________________________________
  3962.    Data Block       See Below                         01
  3963.    Dialect          Null terminated ASCII String      02
  3964.    Pathname         Null terminated ASCII String      03
  3965.    ASCII            Null terminated ASCII String      04
  3966.    Variable block   See Below                         05
  3967.   _______________________________________________________
  3968.   |||||||||
  3969.  
  3970.  
  3971.  
  3972.  
  3973.  
  3974.  
  3975.                   |||||||
  3976.  
  3977.  
  3978.  
  3979.  
  3980.  
  3981.                                                  |||||||
  3982.  
  3983.  
  3984.  
  3985.  
  3986.  
  3987.                                                          |||||||||
  3988.  
  3989.  
  3990.  
  3991.  
  3992.  
  3993.  
  3994.  
  3995.  
  3996. When the identifier indicates a data block or variable block
  3997. then  the format is a word indicating the length followed by
  3998. the data. ASCII strings are null terminated.
  3999.  
  4000. Despite the flexible encoding scheme, no  field  of  a  data
  4001. portion  may  be omitted or included out of order.  In addi-
  4002. tion, neither an smb_wct nor smb_bcc of value 0 at  the  end
  4003. of a message may be omitted.
  4004.  
  4005. _7._3.  _C_o_m_m_a_n_d _C_o_d_e_s
  4006.  
  4007. The following values have been  assigned  for  the  protocol
  4008. commands.
  4009.  
  4010. #define SMBmkdir      0x00   /* create directory */
  4011. #define SMBrmdir      0x01   /* delete directory */
  4012. #define SMBopen       0x02   /* open file */
  4013. #define SMBcreate     0x03   /* create file */
  4014. #define SMBclose      0x04   /* close file */
  4015. #define SMBflush      0x05   /* flush file */
  4016. #define SMBunlink     0x06   /* delete file */
  4017. #define SMBmv         0x07   /* rename file */
  4018. #define SMBgetatr     0x08   /* get file attributes */
  4019. #define SMBsetatr     0x09   /* set file attributes */
  4020. #define SMBread       0x0A   /* read from file */
  4021. #define SMBwrite      0x0B   /* write to file */
  4022. #define SMBlock       0x0C   /* lock byte range */
  4023.  
  4024.  
  4025.  
  4026. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  4027.  
  4028.  
  4029.  
  4030.  
  4031.  
  4032. File Sharing Protocol      - 48 -           November 7, 1988
  4033.  
  4034.  
  4035. #define SMBunlock     0x0D   /* unlock byte range */
  4036. #define SMBctemp      0x0E   /* create temporary file */
  4037. #define SMBmknew      0x0F   /* make new file */
  4038. #define SMBchkpth     0x10   /* check directory path */
  4039. #define SMBexit       0x11   /* process exit */
  4040. #define SMBlseek      0x12   /* seek */
  4041. #define SMBtcon       0x70   /* tree connect */
  4042. #define SMBtdis       0x71   /* tree disconnect */
  4043. #define SMBnegprot    0x72   /* negotiate protocol */
  4044. #define SMBdskattr    0x80   /* get disk attributes */
  4045. #define SMBsearch     0x81   /* search directory */
  4046. #define SMBsplopen    0xC0   /* open print spool file */
  4047. #define SMBsplwr      0xC1   /* write to print spool file */
  4048. #define SMBsplclose   0xC2   /* close print spool file */
  4049. #define SMBsplretq    0xC3   /* return print queue */
  4050. #define SMBsends      0xD0   /* send single block message */
  4051. #define SMBsendb      0xD1   /* send broadcast message */
  4052. #define SMBfwdname    0xD2   /* forward user name */
  4053. #define SMBcancelf    0xD3   /* cancel forward */
  4054. #define SMBgetmac     0xD4   /* get machine name */
  4055. #define SMBsendstrt   0xD5   /* send start of multi-block message */
  4056. #define SMBsendend    0xD6   /* send end of multi-block message */
  4057. #define SMBsendtxt    0xD7   /* send text of multi-block message */
  4058.  
  4059.  
  4060. _7._4.  _E_r_r_o_r _C_o_d_e_s _a_n_d _C_l_a_s_s_e_s
  4061.  
  4062. _E_R_R_O_R _C_L_A_S_S _C_O_D_E_S
  4063.  
  4064.  
  4065. SUCCESS   0The request was successful.
  4066. ERRDOS 0x01Error is generated by the server operating system.
  4067. ERRSRV 0x02Error is generated by the server network file manager.
  4068. ERRHRD 0x03Error is an hardware error (MS-DOS int 24).
  4069. ERRCMD 0xFFCommand was not in the "SMB" format.  (optional)
  4070.  
  4071.  
  4072. The following error codes may be generated with the  SUCCESS
  4073. error class.
  4074.  
  4075. SUCCESS               0          The request was successful.
  4076. BUFFERED           0x54          message has been buffered
  4077. LOGGED             0x55          message has been logged
  4078. DISPLAYED          0x56          user message displayed
  4079.  
  4080.  
  4081. The following error codes may be generated with  the  ERRDOS
  4082. error  class.   The XENIX errors equivalent to each of these
  4083. errors are noted at the end of the error description.
  4084.  
  4085. ERRbadfunc   1
  4086.                Invalid function.  The server OS did not recognize or could not  perform
  4087.                a system call generated by the server, e.g., set the DIRECTORY attribute
  4088.                on a data file, invalid seek mode. [EINVAL]
  4089.  
  4090.  
  4091.  
  4092.  
  4093. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  4094.  
  4095.  
  4096.  
  4097.  
  4098.  
  4099. File Sharing Protocol      - 49 -           November 7, 1988
  4100.  
  4101.  
  4102. ERRbadfile   2
  4103.                File not found.  The last component of a file's pathname  could  not  be
  4104.                found.  [ENOENT]
  4105. ERRbadpath   3
  4106.                Directory invalid.  A directory component in a  pathname  could  not  be
  4107.                found.  [ENOENT]
  4108. ERRnofids    4
  4109.                Too many open files.  The server has no file handles  (fids)  available.
  4110.                [EMFILE]
  4111. ERRnoaccess  5
  4112.                Access denied, the requester's context does  not  permit  the  requested
  4113.                function.  This includes the following conditions.  [EPERM]
  4114.                    duplicate name errors
  4115.                    invalid rename command
  4116.                    write to fid open for read only
  4117.                    read on fid open for write only
  4118.                    attempt to open read-only file for write
  4119.                    attempt to delete read-only file
  4120.                    attempt to set attributes of a read only file
  4121.                    attempt to create a file on a full server
  4122.                    directory full
  4123.                    attempt to delete a non-empty directory
  4124.                    invalid file type (e.g., file commands on a directory)
  4125. ERRbadfid     6
  4126.                Invalid file handle.  The file handle specified was  not  recognized  by
  4127.                the server.  [EBADF]
  4128. ERRbadmcb     7Memory control blocks destroyed.  [EREMOTEIO]
  4129. ERRnomem      8Insufficient server memory to perform the requested function.  [ENOMEM]
  4130. ERRbadmem     9Invalid memory block address.  [EFAULT]
  4131. ERRbadenv    10Invalid environment.  [EREMOTEIO]
  4132. ERRbadformat 11Invalid format.  [EREMOTEIO]
  4133. ERRbadaccess 12Invalid open mode.
  4134. ERRbaddata   13Invalid data (generated only by IOCTL calls within the server).  [E2BIG]
  4135. ERR          14reserved
  4136. ERRbaddrive  15Invalid drive specified.  [ENXIO]
  4137. ERRremcd     16
  4138.                A Delete Directory request attempted  to  remove  the  server's  current
  4139.                directory.  [EREMOTEIO]
  4140. ERRdiffdevice17Not same device (e.g., a cross volume rename was attempted)  [EXDEV]
  4141. ERRnofiles   18
  4142.                A File Search command can find no more files matching the specified cri-
  4143.                teria.
  4144. ERRbadshare  32
  4145.                The sharing mode specified for a non-compatibility mode  Open  conflicts
  4146.                with existing FIDs on the file.  [ETXTBSY]
  4147. ERRlock      33
  4148.                A Lock request conflicted with an existing lock or specified an  invalid
  4149.                mode,  or  an  Unlock request attempted to remove a lock held by another
  4150.                process.  [EDEADLOCK]
  4151. ERRfilexists 80
  4152.                The file named in a Create Directory or Make New  File  request  already
  4153.                exists.  The  error may also be generated in the Create and Rename tran-
  4154.                sactions.  [EEXIST]
  4155.  
  4156.  
  4157. The following error codes may be generated with  the  ERRSRV
  4158. error class.
  4159.  
  4160. ERRerror          1Non-specific error code.  It is returned under the following conditions:
  4161.                        resource other than disk space exhausted (e.g., TIDs)
  4162.                        first command on VC was not negotiate
  4163.                        multiple negotiates attempted
  4164.                        internal server error [ENFILE]
  4165.  
  4166.  
  4167. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  4168.  
  4169.  
  4170.  
  4171.  
  4172.  
  4173. File Sharing Protocol      - 50 -           November 7, 1988
  4174.  
  4175.  
  4176. ERRbadpw          2Bad password - name/password pair in a Tree Connect is invalid.
  4177. ERRbadtype        3reserved
  4178. ERRaccess         4
  4179.                    The requester does not have  the  necessary  access  rights  within  the
  4180.                    specified TID context for the requested function.  [EACCES]
  4181. ERRinvnid         5The tree ID (tid) specified in a command was invalid.
  4182. ERRinvnetname     6Invalid name supplied with tree connect.
  4183. ERRinvdevice      7
  4184.                    Invalid device - printer request made to non-printer connection or  non-
  4185.                    printer request made to printer connection.
  4186. ERRqfull         49Print queue full (files) -- returned by open print file.
  4187. ERRqtoobig       50Print queue full -- no space.
  4188. ERRqeof          51EOF on print queue dump.
  4189. ERRinvpfid       52Invalid print file FID.
  4190. ERRpaused        81Server is paused.
  4191. ERRmsgoff        82Not receiving messages.
  4192. ERRnoroom        83No room to buffer message.
  4193. ERRrmuns         87Too many remote user names.
  4194. ERRnosupport 0xFFFFFunction not supported.
  4195.  
  4196.  
  4197. The following error codes may be generated with  the  ERRHRD
  4198. error  class.   The XENIX errors equivalent to each of these
  4199. errors are noted at the end of the error description.
  4200.  
  4201. ERRnowrite  19Attempt to write on write-protected diskette.  [EROFS]
  4202. ERRbadunit  20Unknown unit.  [ENODEV]
  4203. ERRnotready 21Drive not ready.  [EUCLEAN]
  4204. ERRbadcmd   22Invalid disk command.
  4205. ERRdata     23Data error (CRC).  [EIO]
  4206. ERRbadreq   24Bad request structure length.  [ERANGE]
  4207. ERRseek     25Seek error.
  4208. ERRbadmedia 26Unknown media type.
  4209. ERRbadsector27Sector not found.
  4210. ERRnopaper  28Printer out of paper.
  4211. ERRwrite    29Write fault.
  4212. ERRread     30Read fault.
  4213. ERRgeneral  31General failure.
  4214. ERRbadshare 32
  4215.               A compatibility mode open conflicts with  an  existing
  4216.               open on the file.  [ETXTBSY]
  4217.  
  4218.  
  4219. _8.  _E_x_c_e_p_t_i_o_n _H_a_n_d_l_i_n_g
  4220.  
  4221. Exception handling is built upon  the  various  environments
  4222. supported  by  the  file sharing protocol (see ARCHITECTURAL
  4223. MODEL section). When any environment is dissolved (in either
  4224. an orderly or disorderly fashion) all contained environments
  4225. are dissolved.  The hierarchy of environments is  summarized
  4226. below:
  4227.  
  4228.         Virtual Circuit
  4229.                   TID
  4230.                   PID
  4231.                   FID
  4232.  
  4233.  
  4234.  
  4235.  
  4236. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  4237.  
  4238.  
  4239.  
  4240.  
  4241.  
  4242. File Sharing Protocol      - 51 -           November 7, 1988
  4243.  
  4244.  
  4245. As can be seen from this summary, the Virtual  Circuit  (VC)
  4246. is  the  key environment.  When a VC is dissolved the server
  4247. processes (or equivalent) are terminated; the TIDs, PIDs and
  4248. FIDs are invalidated, and any outstanding request is dropped
  4249. -- a response will not be generated.
  4250.  
  4251. The termination of a PID will close all  FIDs  it  contains.
  4252. The  destruction  of  TIDs  and  FIDs has no affect on other
  4253. environments.
  4254.  
  4255. If the server receives a message with a  bad  format,  e.g.,
  4256. lacks the "FFSMB" header, it may abort the VC.
  4257.  
  4258. If a server is unable to deliver  responses  to  a  consumer
  4259. within  n  seconds, it considers the consumer dead and drops
  4260. the VC to it (we anticipate that n will be a function of the
  4261. transport round trip delay time).
  4262.  
  4263.  
  4264.  
  4265.  
  4266.  
  4267.  
  4268.  
  4269.  
  4270.  
  4271.  
  4272.  
  4273.  
  4274.  
  4275.  
  4276.  
  4277.  
  4278.  
  4279.  
  4280.  
  4281.  
  4282.  
  4283.  
  4284.  
  4285.  
  4286.  
  4287.  
  4288.  
  4289.  
  4290.  
  4291.  
  4292.  
  4293.  
  4294.  
  4295.  
  4296.  
  4297.  
  4298.  
  4299.  
  4300.  
  4301.  
  4302. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  4303.  
  4304.  
  4305.  
  4306.  
  4307.  
  4308. File Sharing Protocol      - 52 -           November 7, 1988
  4309.  
  4310.  
  4311.                   _A_p_p_e_n_d_i_x _A - _A_n _E_x_a_m_p_l_e
  4312.  
  4313. In this example a MS-DOS machine will access  a  file  on  a
  4314. remote machine that is running a server that supports MS-DOS
  4315. file sharing.
  4316.  
  4317. STEP 1: Using  protocols  described  elsewhere,  the  MS-DOS
  4318. machine has obtained a virtual circuit (VC) to the server on
  4319. the remote machine.  The MS-DOS machine will  then  generate
  4320. "Negotiate Message" on the VC with a dialect field that con-
  4321. tains "PC NETWORK PROGRAM  1.0".   The  remote  server  will
  4322. respond  with a "Negotiate Reply Message" which will contain
  4323. the index of the dialect string that contained  "PC  NETWORK
  4324. PROGRAM  1.0",  in this case 1, which indicates that it will
  4325. service that protocol.
  4326.  
  4327. STEP 2: The MS-DOS machine now  generates  a  "Tree  Connect
  4328. Message"  with a pathname and a password.  The remote server
  4329. will respond with a "Tree Connect Response Message" indicat-
  4330. ing  that  the password has been validated permitting access
  4331. to the associated sub-tree.  A "Tree  ID"  is  returned  for
  4332. future use.
  4333.  
  4334. STEP 3: The MS-DOS machine wishes to open and read a file on
  4335. the  remote  server.  This would be in response to a program
  4336. that referenced a file on that remote  system.   The  MS-DOS
  4337. machine  will  generate, in response to a user program open,
  4338. an "Open Message" with the "file path" of  the  file  to  be
  4339. opened along with the mode information and the tree id.  The
  4340. file-path must not contain the path specified  in  the  tree
  4341. connect message.  The server will respond with a "Open Reply
  4342. Message" which will contain  a  file  handle  for  use  with
  4343. future  messages.   It  will  also  return the file size and
  4344. modification time.
  4345.  
  4346. STEP 4: The MS-DOS machine now reads the file,  in  response
  4347. to  user  program file reads.  It will generate a "Read Mes-
  4348. sage" with the "file handle" obtained from  the  "open  mes-
  4349. sage".  The message will contain a count of bytes to be read
  4350. and an offset within the file to start reading, and possibly
  4351. count  indicating  future requests.  The server will respond
  4352. with a "Read Reply Message" with the count of data read  and
  4353. the data.
  4354.  
  4355. STEP 5: Some number of "Read Messages" and  possibly  "Write
  4356. Messages" are transmitted, and eventually the file is closed
  4357. by the user process.  The MS-DOS  machine  will  generate  a
  4358. "Close  Message"  which  contains the "file handle" obtained
  4359. from the "Open Response  Message"  and  a  new  modification
  4360. time.  The server responds with a "Close Response Message".
  4361.  
  4362. STEP 6: At some time the MS-DOS machine  generates  a  "Tree
  4363. Disconnect Message" and receives a "Tree Disconnect Response
  4364. Message." At this point the VC may be de-allocated.
  4365.  
  4366.  
  4367.  
  4368. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  4369.  
  4370.  
  4371.  
  4372.  
  4373.  
  4374. File Sharing Protocol      - 53 -           November 7, 1988
  4375.  
  4376.  
  4377.  
  4378.  
  4379.  
  4380.  
  4381.  
  4382.  
  4383.  
  4384.  
  4385.  
  4386.  
  4387.  
  4388.  
  4389.  
  4390.  
  4391.  
  4392.  
  4393.  
  4394.  
  4395.  
  4396.  
  4397.  
  4398.  
  4399.  
  4400.  
  4401.  
  4402.  
  4403.  
  4404.  
  4405.  
  4406.  
  4407.  
  4408.  
  4409.  
  4410.  
  4411.  
  4412.  
  4413.  
  4414.  
  4415.  
  4416.  
  4417.  
  4418.  
  4419.  
  4420.  
  4421.  
  4422.  
  4423.  
  4424.  
  4425.  
  4426.  
  4427.  
  4428.  
  4429.  
  4430.  
  4431.  
  4432.  
  4433.  
  4434. Copyright Microsoft Corp., 1987, 1988November 30, 1990      INTEL PN 138446
  4435.  
  4436.  
  4437.