Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

369 lines
15 KiB

  1. @perl -x -w %0 %*
  2. @goto :eof
  3. #!perl
  4. ################################################################################
  5. #
  6. # Script begins here. Above is overhead to make a happy batch file.
  7. #
  8. ################################################################################
  9. use srTest;
  10. use Cwd;
  11. my $dev = substr(cwd(),0,2);
  12. my $opOpt = "";
  13. my $sfOpt = "";
  14. #
  15. # the command to execute
  16. #
  17. # Operator defintions:
  18. # nnn: Commands to execute (can be search for)
  19. # ! internal PERL commands to be executed silently
  20. # ... anything else is a command to bshell
  21. #
  22. #
  23. SrRun (
  24. #link file, file relative
  25. "1:Create link to \\lntest\\a.exe from\n \\lntest\\b.exe, file relative, no overwrite",
  26. "!mkdir '$dev/lntest/', 0",
  27. "!unlink '$dev/lntest/b.exe'", #make sure test files don't exist
  28. "op $opOpt /f\\$dev\\lntest\\a.exe /dzj /pzd",
  29. "sf $sfOpt /i0 /pf /cc /fnb.exe",
  30. "cl /i0",
  31. "2:Create link to \\lntest\\a.exe from\n \\lntest\\b.exe, file relative, overwrite, not allowed",
  32. "!mkdir '$dev/lntest/', 0",
  33. "!unlink '$dev/lntest/b.exe'",
  34. "!crfile '$dev/lntest/b.exe'",
  35. "op $opOpt /f\\$dev\\lntest\\a.exe /dzj /pzd",
  36. "sf $sfOpt /i0 /pf /cc /fnb.exe",
  37. "cl /i0",
  38. "3:Create link to \\lntest\\a.exe from\n \\lntest\\b.exe, file relative, overwrite",
  39. "!mkdir '$dev/lntest/', 0",
  40. "!unlink '$dev/lntest/b.exe'",
  41. "!crfile '$dev/lntest/b.exe'",
  42. "op $opOpt /f\\$dev\\lntest\\a.exe /dzj /pzd",
  43. "sf $sfOpt /i0 /pt /cc /fnb.exe",
  44. "cl /i0",
  45. "4:Create link to \\lntest\\a.exe from\n \\lntest\\b.dat, file relative, to unmonitored, no overwrite",
  46. "!mkdir '$dev/lntest/', 0",
  47. "!unlink '$dev/lntest/b.dat'",
  48. "op $opOpt /f\\$dev\\lntest\\a.exe /dzj /pzd",
  49. "sf $sfOpt /i0 /pf /cc /fnb.dat",
  50. "cl /i0",
  51. "5:Create link to \\lntest\\a.exe from\n \\lntest\\b.dat, file relative, to unmonitored, overwrite",
  52. "!mkdir '$dev/lntest/', 0",
  53. "!unlink '$dev/lntest/b.dat'",
  54. "!crfile '$dev/lntest/b.dat'",
  55. "op $opOpt /f\\$dev\\lntest\\a.exe /dzj /pzd",
  56. "sf $sfOpt /i0 /pt /cc /fnb.dat",
  57. "cl /i0",
  58. "6:Create link to \\lntest\\a.dat from\n \\lntest\\b.exe, file relative, to interesting, no overwrite",
  59. "!mkdir '$dev/lntest/', 0",
  60. "!unlink '$dev/lntest/b.exe'",
  61. "op $opOpt /f\\$dev\\lntest\\a.dat /dzj /pzd",
  62. "sf $sfOpt /i0 /pf /cc /fnb.exe",
  63. "cl /i0",
  64. "7:Create link to \\lntest\\a.dat from\n \\lntest\\b.exe, file relative, to interesting, overwrite",
  65. "!mkdir '$dev/lntest/', 0",
  66. "!unlink '$dev/lntest/b.exe'",
  67. "!crfile '$dev/lntest/b.exe'",
  68. "op $opOpt /f\\$dev\\lntest\\a.dat /dzj /pzd",
  69. "sf $sfOpt /i0 /pt /cc /fnb.exe",
  70. "cl /i0",
  71. #Create link to, via shortname
  72. "8:Create link to \\lntest\\alongf~1.exe from\n \\lntest\\anotherLongFileName.exe, file relative, via shortname",
  73. "!mkdir '$dev/lntest/', 0",
  74. "!unlink '$dev/lntest/anotherLongFileName.exe'",
  75. "!crfile '$dev/lntest/aLongFileName.exe'",
  76. "op $opOpt /f\\$dev\\lntest\\alongf~1.exe /dzj /pzb",
  77. "sf $sfOpt /i0 /pf /cc /fnanotherLongFileName.exe",
  78. "cl /i0",
  79. #Create link to, to shortname, no overwrite
  80. "9:Create link to \\lntest\\a.exe from\n \\lntest\\alongf~1.exe, file relative, no overwrite",
  81. "!mkdir '$dev/lntest/', 0",
  82. "!unlink '$dev/lntest/alongf~1.exe'",
  83. "op $opOpt /f\\$dev\\lntest\\a.exe /dzj /pzd",
  84. "sf $sfOpt /i0 /pf /cc /fnalongf~1.exe",
  85. "cl /i0",
  86. #Create link to, to shortname, overwrite
  87. "10:Create link to \\lntest\\a.exe from\n \\lntest\\alongf~1.exe, file relative, overwrite",
  88. "!mkdir '$dev/lntest/', 0",
  89. "!unlink '$dev/lntest/alongf~1.exe'",
  90. "!unlink '$dev/lntest/aLongFileName.exe'",
  91. "!crfile '$dev/lntest/aLongFileName.exe'",
  92. "op $opOpt /f\\$dev\\lntest\\a.exe /dzj /pzd",
  93. "sf $sfOpt /i0 /pt /cc /fnalongf~1.exe",
  94. "cl /i0",
  95. #Create link to, to it own shortname
  96. "11:Create link to \\lntest\\aLongFileName.exe from\n \\lntest\\alongf~1.exe, file relative, to its own shortname",
  97. "!mkdir '$dev/lntest/', 0",
  98. "!unlink '$dev/lntest/alongf~1.exe'",
  99. "!unlink '$dev/lntest/aLongFileName.exe'",
  100. "!crfile '$dev/lntest/aLongFileName.exe'",
  101. "op $opOpt /f\\$dev\\lntest\\aLongFileName.exe /dzj /pzd",
  102. "sf $sfOpt /i0 /pt /cc /fnalongf~1.exe",
  103. "cl /i0",
  104. #Link directory, file relative, with files
  105. "12:Link directory \\lntestDirectory from\n \\lnDirectoryTest, file relative, with files, not allowed",
  106. "!mkdir '$dev/lntestDirectory/', 0",
  107. "!crfile '$dev/lntestDirectory/1.exe', 0",
  108. "!crfile '$dev/lntestDirectory/2.exe', 0",
  109. "!crfile '$dev/lntestDirectory/3.dat', 0",
  110. "!unlink <$dev/lnDirectoryTest/*>",
  111. "!rmdir '$dev/lnDirectoryTest'",
  112. "op $opOpt /f\\$dev\\lntestDirectory /dzaj /pzb /nza",
  113. "sf $sfOpt /i0 /pf /cc /fnlnDirectoryTest",
  114. "cl /i0",
  115. "13:Create link to \\lntest\\a.dat from\n \\lntest\\b.dat, file relative, no overwrite",
  116. "!mkdir '$dev/lntest/', 0",
  117. "!unlink '$dev/lntest/b.dat'", #make sure test files don't exist
  118. "op $opOpt /f\\$dev\\lntest\\a.dat /dzj /pzd",
  119. "sf $sfOpt /i0 /pf /cc /fnb.dat",
  120. "cl /i0",
  121. #Create link to over directory (fails)
  122. "14:Create link to \\lntest\\a.exe from\n directory \\lntest\\subdir, file relative, will fail",
  123. "!mkdir '$dev/lntest/', 0",
  124. "!mkdir '$dev/lntest/subdir/', 0",
  125. "op $opOpt /f\\$dev\\lntest\\a.exe /dzj /pzd",
  126. "sf $sfOpt /i0 /pt /cc /fnsubdir",
  127. "cl /i0",
  128. #Create link from directory to file (fails)
  129. "15:Link directory \\lntest\\subdir1 to\n directory \\lntest\\aaa.exe, file relative, overwrite file with directory, will fail ",
  130. "!mkdir '$dev/lntest/', 0",
  131. "!mkdir '$dev/lntest/subdir1', 0",
  132. "!rmdir '$dev/lntest/aaa.exe'",
  133. "!crfile '$dev/lntest/aaa.exe', 0",
  134. "op $opOpt /f\\$dev\\lntest\\subdir1 /dzaj /pzb /nza",
  135. "sf $sfOpt /i0 /pt /cc /fnaaa.exe",
  136. "cl /i0",
  137. #Create link to, full path
  138. "41:Create link to \\lntest1\\a.exe from\n \\lntest2\\b.exe, full path, no overwrite",
  139. "!mkdir '$dev/lntest1/', 0",
  140. "!mkdir '$dev/lntest2/', 0",
  141. "!unlink '$dev/lntest2/b.exe'",
  142. "op $opOpt /f\\$dev\\lntest1\\a.exe /dzj /pzd",
  143. "sf $sfOpt /i0 /pf /cc /fn\\??\\$dev\\lntest2\\b.exe",
  144. "cl /i0",
  145. "42:Create link to \\lntest1\\a.exe from\n \\lntest2\\b.exe, full path, overwrite, not allowed",
  146. "!mkdir '$dev/lntest1/', 0",
  147. "!mkdir '$dev/lntest2/', 0",
  148. "!unlink '$dev/lntest2/b.exe'",
  149. "!crfile '$dev/lntest2/b.exe'",
  150. "op $opOpt /f\\$dev\\lntest1\\a.exe /dzj /pzd",
  151. "sf $sfOpt /i0 /pf /cc /fn\\??\\$dev\\lntest2\\b.exe",
  152. "cl /i0",
  153. "43:Create link to \\lntest1\\a.exe from\n \\lntest2\\b.exe, full path, overwrite",
  154. "!mkdir '$dev/lntest1/', 0",
  155. "!mkdir '$dev/lntest2/', 0",
  156. "!unlink '$dev/lntest2/b.exe'",
  157. "!crfile '$dev/lntest2/b.exe'",
  158. "op $opOpt /f\\$dev\\lntest1\\a.exe /dzj /pzd",
  159. "sf $sfOpt /i0 /pt /cc /fn\\??\\$dev\\lntest2\\b.exe",
  160. "cl /i0",
  161. "44:Create link to \\lntest1\\a.exe from\n \\lntest2\\b.dat, full path, to unmonitored, no overwrite",
  162. "!mkdir '$dev/lntest1/', 0",
  163. "!mkdir '$dev/lntest2/', 0",
  164. "!unlink '$dev/lntest2/b.dat'",
  165. "!unlink '$dev/lntest2/b.dat'",
  166. "op $opOpt /f\\$dev\\lntest1\\a.exe /dzj /pzd",
  167. "sf $sfOpt /i0 /pf /cc /fn\\??\\$dev\\lntest2\\b.dat",
  168. "cl /i0",
  169. "45:Create link to \\lntest1\\a.exe from\n \\lntest2\\b.dat, full path, to unmonitored, overwrite",
  170. "!mkdir '$dev/lntest1/', 0",
  171. "!mkdir '$dev/lntest2/', 0",
  172. "!unlink '$dev/lntest2/b.dat'",
  173. "!crfile '$dev/lntest2/b.dat'",
  174. "op $opOpt /f\\$dev\\lntest1\\a.exe /dzj /pzd",
  175. "sf $sfOpt /i0 /pt /cc /fn\\??\\$dev\\lntest2\\b.dat",
  176. "cl /i0",
  177. "46:Create link to \\lntest1\\a.dat from\n \\lntest2\\b.exe, full path, to interesting, no overwrite",
  178. "!mkdir '$dev/lntest1/', 0",
  179. "!mkdir '$dev/lntest2/', 0",
  180. "!unlink '$dev/lntest2/b.exe'",
  181. "op $opOpt /f\\$dev\\lntest1\\a.dat /dzj /pzd",
  182. "sf $sfOpt /i0 /pf /cc /fn\\??\\$dev\\lntest2\\b.exe",
  183. "cl /i0",
  184. "47:Create link to \\lntest1\\a.dat from\n \\lntest2\\b.exe, full path, to interesting, overwrite",
  185. "!mkdir '$dev/lntest1/', 0",
  186. "!mkdir '$dev/lntest2/', 0",
  187. "!unlink '$dev/lntest2/b.exe'",
  188. "!crfile '$dev/lntest2/b.exe'",
  189. "op $opOpt /f\\$dev\\lntest1\\a.dat /dzj /pzd",
  190. "sf $sfOpt /i0 /pt /cc /fn\\??\\$dev\\lntest2\\b.exe",
  191. "cl /i0",
  192. #Create link to, via shortname
  193. "48:Create link to \\lntest1\\alongf~1.exe from\n \\lntest2\\anotherLongFileName.exe, full path, via shortname",
  194. "!mkdir '$dev/lntest1/', 0",
  195. "!mkdir '$dev/lntest2/', 0",
  196. "!unlink '$dev/lntest2/anotherLongFileName.exe'",
  197. "!crfile '$dev/lntest1/aLongFileName.exe'",
  198. "op $opOpt /f\\$dev\\lntest1\\alongf~1.exe /dzj /pzb",
  199. "sf $sfOpt /i0 /pf /cc /fn\\??\\$dev\\lntest2\\anotherLongFileName.exe",
  200. "cl /i0",
  201. #Create link to, to shortname, no overwrite
  202. "49:Create link to \\lntest\\a.exe from\n \\lntest\\alongf~1.exe, full path, no overwrite",
  203. "!mkdir '$dev/lntest/', 0",
  204. "!unlink '$dev/lntest/alongf~1.exe'",
  205. "op $opOpt /f\\$dev\\lntest\\a.exe /dzj /pzd",
  206. "sf $sfOpt /i0 /pf /cc /fn\\??\\$dev\\lntest\\alongf~1.exe",
  207. "cl /i0",
  208. #Create link to, to shortname, overwrite
  209. "50:Create link to \\lntest\\a.exe from\n \\lntest\\alongf~1.exe, full path, overwrite",
  210. "!mkdir '$dev/lntest/', 0",
  211. "!unlink '$dev/lntest/alongf~1.exe'",
  212. "!unlink '$dev/lntest/aLongFileName.exe'",
  213. "!crfile '$dev/lntest/aLongFileName.exe'",
  214. "op $opOpt /f\\$dev\\lntest\\a.exe /dzj /pzd",
  215. "sf $sfOpt /i0 /pt /cc /fn\\??\\$dev\\lntest\\alongf~1.exe",
  216. "cl /i0",
  217. #Create link to, to it own shortname
  218. "51:Create link to \\lntest\\aLongFileName.exe from\n \\lntest\\alongf~1.exe, full path, to its own shortname",
  219. "!mkdir '$dev/lntest/', 0",
  220. "!unlink '$dev/lntest/alongf~1.exe'",
  221. "!unlink '$dev/lntest/aLongFileName.exe'",
  222. "!crfile '$dev/lntest/aLongFileName.exe'",
  223. "op $opOpt /f\\$dev\\lntest\\aLongFileName.exe /dzj /pzd",
  224. "sf $sfOpt /i0 /pt /cc /fn\\??\\$dev\\lntest\\alongf~1.exe",
  225. "cl /i0",
  226. #Link directory, fullpath - will fail
  227. "52:Link to directory \\lntest1\\lntestDirectory from\n \\lntest2\\lnDirectoryTest, full path, with files, will fail",
  228. "!mkdir '$dev/lntest1/', 0",
  229. "!mkdir '$dev/lntest2/', 0",
  230. "!mkdir '$dev/lntest1/lntestDirectory/', 0",
  231. "!crfile '$dev/lntest1/lntestDirectory/1.exe', 0",
  232. "!crfile '$dev/lntest1/lntestDirectory/2.exe', 0",
  233. "!crfile '$dev/lntest1/lntestDirectory/3.dat', 0",
  234. "!unlink <$dev/lntest2/lnDirectoryTest/*>",
  235. "!rmdir '$dev/lntest2/lnDirectoryTest/'",
  236. "op $opOpt /f\\$dev\\lntest1\\lntestDirectory /dzaj /pzb /nza",
  237. "sf $sfOpt /i0 /pf /cc /fn\\??\\$dev\\lntest2\\lnDirectoryTest",
  238. "cl /i0",
  239. #link to directory, fullpath - will fail
  240. "53:Link to directory \\lntest1\\lntestDirectory from\n \\temp\\lntestDirectory, full path, with files, to unmonitored, will fail",
  241. "!mkdir '$dev/lntest1/', 0",
  242. "!mkdir '$dev/temp/', 0",
  243. "!mkdir '$dev/lntest1/lntestDirectory/', 0",
  244. "!crfile '$dev/lntest1/lntestDirectory/1.exe', 0",
  245. "!crfile '$dev/lntest1/lntestDirectory/2.exe', 0",
  246. "!crfile '$dev/lntest1/lntestDirectory/3.dat', 0",
  247. "!unlink <$dev/temp/lntestDirectory/*>",
  248. "!rmdir '$dev/temp/lntestDirectory/'",
  249. "op $opOpt /f\\$dev\\lntest1\\lntestDirectory /dzaj /pzb /nza",
  250. "sf $sfOpt /i0 /pf /cc /fn\\??\\$dev\\temp\\lntestDirectory",
  251. "cl /i0",
  252. #link to directory, fullpath - will fail
  253. "54:Link to directory \\temp\\lntestDirectory from\n \\lntest2\\lntestDirectory, full path, with files, to unmonitored, will fail",
  254. "!mkdir '$dev/temp/', 0",
  255. "!mkdir '$dev/lntest2/', 0",
  256. "!mkdir '$dev/temp/lntestDirectory/', 0",
  257. "!crfile '$dev/temp/lntestDirectory/1.exe', 0",
  258. "!crfile '$dev/temp/lntestDirectory/2.exe', 0",
  259. "!crfile '$dev/temp/lntestDirectory/3.dat', 0",
  260. "!unlink <$dev/lntest2/lntestDirectory/*>",
  261. "!rmdir '$dev/lntest2/lntestDirectory/'",
  262. "op $opOpt /f\\$dev\\temp\\lntestDirectory /dzaj /pzb /nza",
  263. "sf $sfOpt /i0 /pf /cc /fn\\??\\$dev\\lntest2\\lntestDirectory",
  264. "cl /i0",
  265. #Create link to, path relative
  266. "81:Create link to \\lntest\\subdir1\\a.exe from\n \\lntest\\subdir2\\b.exe, directory relative, no overwrite",
  267. "!mkdir '$dev/lntest/', 0",
  268. "!mkdir '$dev/lntest/subdir1/', 0",
  269. "!mkdir '$dev/lntest/subdir2/', 0",
  270. "!unlink '$dev/lntest/subdir2/b.exe'",
  271. "op $opOpt /f\\$dev\\lntest\\ /dza /pzb /nza",
  272. "op $opOpt /f\\$dev\\lntest\\subdir1\\a.exe /dzj /pzd",
  273. "sf $sfOpt /i1 /pf /cc /r0 /fnsubdir2\\b.exe",
  274. "cl /i0",
  275. "cl /i1",
  276. "82:Create link to \\lntest\\subdir1\\a.exe from\n \\lntest\\subdir2\\b.exe, full path, overwrite, not allowed",
  277. "!mkdir '$dev/lntest/', 0",
  278. "!mkdir '$dev/lntest/subdir1/', 0",
  279. "!mkdir '$dev/lntest/subdir2/', 0",
  280. "!unlink '$dev/lntest/subdir2/b.exe'",
  281. "!crfile '$dev/lntest/subdir2/b.exe'",
  282. "op $opOpt /f\\$dev\\lntest\\ /dza /pzb /nza",
  283. "op $opOpt /f\\$dev\\lntest\\subdir1\\a.exe /dzj /pzd",
  284. "sf $sfOpt /ii /pf /cc /r0 /fnsubdir2\\b.exe",
  285. "cl /i0",
  286. "cl /i1",
  287. "83:Create link to \\lntest\\subdir1\\a.exe from\n \\lntest\\subdir2\\b.exe, full path, overwrite",
  288. "!mkdir '$dev/lntest/', 0",
  289. "!mkdir '$dev/lntest/subdir1/', 0",
  290. "!mkdir '$dev/lntest/subdir2/', 0",
  291. "!unlink '$dev/lntest/subdir2/b.exe'",
  292. "!crfile '$dev/lntest/subdir2/b.exe'",
  293. "op $opOpt /f\\$dev\\lntest\\ /dza /pzb /nza",
  294. "op $opOpt /f\\$dev\\lntest\\subdir1\\a.exe /dzj /pzd",
  295. "sf $sfOpt /i1 /pt /cc /r0 /fnsubdir2\\b.exe",
  296. "cl /i1",
  297. "cl /i0",
  298. #Link streams
  299. "100:Link to stream \\lntest\\a.exe:stream1 from\n :stream2, will fail",
  300. "!mkdir '$dev/lntest/', 0",
  301. "!crfile '$dev/lntest/a.exe', 0",
  302. "!crfile '$dev/lntest/a.exe:stream1', 0",
  303. "op $opOpt /f\\$dev\\lntest\\a.exe:stream1 /dzj /pzb",
  304. "sf $sfOpt /i0 /pf /cc /fn:stream2",
  305. "cl /i0",
  306. #Create link to stream from unmonitored to monitored space
  307. "101:Create link to \\lntest\\a.dat with stream :stream1 from\n \\lntest\\b.exe",
  308. "!mkdir '$dev/lntest/', 0",
  309. "!unlink '$dev/lntest/b.exe'",
  310. "!crfile '$dev/lntest/a.dat', 0",
  311. "!crfile '$dev/lntest/a.dat:stream1', 0",
  312. "op $opOpt /f\\$dev\\lntest\\a.dat /dzj /pzb",
  313. "sf $sfOpt /i0 /pf /cc /fnb.exe",
  314. "cl /i0",
  315. );