Leaked source code of windows server 2003
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.

578 lines
14 KiB

  1. <HTML>
  2. <HEAD>
  3. <TITLE>Remote Test Page</TITLE>
  4. <STYLE>
  5. BLOCKQUOTE { margin-top:0; padding-top:0; }
  6. </STYLE>
  7. <SCRIPT>
  8. var aMachines =
  9. [
  10. "edsel01", "edsel02", "edsel03", "edsel04", "edsel05",
  11. "edsel06", "edsel7", "edsel8", "edsel9", "edsel10",
  12. "edsel11", "edsel12",
  13. "windshield",
  14. "EXHAUST",
  15. "headlight",
  16. "antenna",
  17. "studebaker",
  18. "hound-1",
  19. "hound-2",
  20. "upholstry",
  21. "handbrake",
  22. "headerpipe",
  23. "glasspack",
  24. "jackspc2",
  25. "jackspc"
  26. ];
  27. function ErrorCheck(fn)
  28. {
  29. try
  30. {
  31. eval(fn);
  32. }
  33. catch(ex)
  34. {
  35. var i;
  36. var str = '';
  37. for (i in ex)
  38. {
  39. if (typeof(ex[i]) == 'number')
  40. {
  41. var value = ex[i];
  42. if (value < 0)
  43. {
  44. value = value + 0x100000000;
  45. }
  46. str += '\t' + i + ': ' + ex[i] + ' (' + value.toString(16) + ')\n';
  47. }
  48. else
  49. {
  50. str += '\t' + i + ': ' + ex[i] + '\n';
  51. }
  52. }
  53. window.alert("an error occurred while executing '" + fn + "'\n" + str);
  54. }
  55. }
  56. function Connect()
  57. {
  58. window.alert("Try 1");
  59. var g_RemoteObj1 = new ActiveXObject('MTScript.Proxy', "JPORKKA1");
  60. window.alert("Try 2");
  61. var g_RemoteObj2 = new ActiveXObject('MTScript.Remote', "JPORKKA1");
  62. window.alert("Try 3");
  63. var str = '';
  64. RemoteObj.Connect(machname.value);
  65. str = 'Connected to machine ' + RemoteObj.Name + '.<BR>';
  66. str += '&nbsp;&nbsp;&nbsp;Platform = ' + RemoteObj.Platform + '<BR>';
  67. str += '&nbsp;&nbsp;&nbsp;OS = ' + RemoteObj.OS + '<BR>';
  68. str += '&nbsp;&nbsp;&nbsp;MajorVer = ' + RemoteObj.MajorVer + '<BR>';
  69. str += '&nbsp;&nbsp;&nbsp;MinorVer = ' + RemoteObj.MinorVer + '<BR>';
  70. str += '&nbsp;&nbsp;&nbsp;BuildNum = ' + RemoteObj.BuildNum + '<BR>';
  71. str += '&nbsp;&nbsp;&nbsp;PlatformIsNT = ' + RemoteObj.PlatformIsNT + '<BR>';
  72. str += '&nbsp;&nbsp;&nbsp;ServicePack = ' + RemoteObj.ServicePack + '<BR>&nbsp;';
  73. Output.innerHTML = str;
  74. DumpData();
  75. }
  76. function Disconnect()
  77. {
  78. RemoteObj.Disconnect();
  79. Output.innerText = '';
  80. Pub.innerText = '';
  81. }
  82. function SetMode(modename)
  83. {
  84. cmd.value = 'setmode';
  85. args.value = modename;
  86. SendExec();
  87. DumpData();
  88. }
  89. function Init()
  90. {
  91. cmd.value = 'setconfig';
  92. // args.value = 'file://%ScriptPath%\\..\\docs\\config_template.xml';
  93. args.value = 'file://%ScriptPath%\\config_template.xml';
  94. SendExec();
  95. cmd.value = 'setenv';
  96. // args.value = 'file://%ScriptPath%\\..\\docs\\env_template.xml';
  97. args.value = 'file://%ScriptPath%\\env_template.xml';
  98. SendExec();
  99. DumpData();
  100. }
  101. function SendExec()
  102. {
  103. var vRet = RemoteObj.Exec(cmd.value, args.value);
  104. try
  105. {
  106. Output.insertAdjacentText('beforeEnd', 'Exec sent. Return value = "' + vRet + '"');
  107. Output.insertAdjacentHTML('beforeEnd', '<BR>&nbsp;');
  108. }
  109. catch(ex)
  110. {
  111. // Ignore errors
  112. }
  113. }
  114. var g_strDump;
  115. function DumpDataPrivate()
  116. {
  117. g_strDump = '';
  118. try
  119. {
  120. var str = RemoteObj.Exec('getpublic', 'PrivateData');
  121. var pd = eval(str);
  122. DumpObject(pd, 77);
  123. }
  124. catch(ex)
  125. {
  126. debugger;
  127. throw ex;
  128. }
  129. Pub.innerHTML = g_strDump;
  130. }
  131. function DumpData()
  132. {
  133. g_strDump = '';
  134. try
  135. {
  136. var str = RemoteObj.Exec('getpublic', 'root');
  137. var pd = eval(str);
  138. DumpObject(pd, 77);
  139. }
  140. catch(ex)
  141. {
  142. debugger;
  143. throw ex;
  144. }
  145. Pub.innerHTML = g_strDump;
  146. }
  147. function OutputDebugString(str)
  148. {
  149. Output.insertAdjacentText('beforeEnd', str);
  150. Output.insertAdjacentHTML('beforeEnd', '<BR>&nbsp;');
  151. }
  152. function ExitAllProc()
  153. {
  154. var m;
  155. var vRet;
  156. for( m in aMachines)
  157. {
  158. try
  159. {
  160. RemoteObj.Connect(aMachines[m]);
  161. str = 'Connected to machine ' + RemoteObj.Name;
  162. vRet = RemoteObj.Exec("exitprocess", 0);
  163. OutputDebugString("Exit proc on " + aMachines[m] + " returned " + vRet);
  164. RemoteObj.Disconnect();
  165. }
  166. catch(ex)
  167. {
  168. }
  169. }
  170. }
  171. function ConnectAllProc()
  172. {
  173. var m;
  174. for( m in aMachines)
  175. {
  176. try
  177. {
  178. RemoteObj.Connect(aMachines[m]);
  179. var str = RemoteObj.Exec('getpublic', 'nDataVersion');
  180. str = RemoteObj.Name + " OK";
  181. OutputDebugString(str);
  182. RemoteObj.Disconnect();
  183. }
  184. catch(ex)
  185. {
  186. OutputDebugString(aMachines[m] + " " + ex.description);
  187. }
  188. }
  189. }
  190. function Browse()
  191. {
  192. var opt;
  193. var strRootTag;
  194. var strFilePattern = '*PublicData*.log';
  195. var strTempDir;
  196. FSObj = new ActiveXObject('Scripting.FileSystemObject');
  197. strTempDir = FSObj.GetSpecialFolder(2).Path; // Temp Folder
  198. comdlg.FileName = strFilePattern;
  199. comdlg.DialogTitle = 'Select Log File';
  200. comdlg.Flags = 524288 + // Use explorer format
  201. 4 + // Hide read-only checkbox
  202. 2048 + // Path must exist
  203. 4096; // File must exist
  204. comdlg.Filter = 'LOG Files (*.log)|*PublicData*.log';
  205. comdlg.InitDir = strTempDir;
  206. comdlg.ShowOpen();
  207. if (comdlg.FileName == strFilePattern)
  208. return;
  209. return comdlg.FileName;
  210. }
  211. function ViewPDLog()
  212. {
  213. try
  214. {
  215. var strFileName = Browse();
  216. if (!strFileName)
  217. return;
  218. var FSObj = new ActiveXObject("Scripting.FileSystemObject");
  219. var logfile = FSObj.OpenTextFile(strFileName, 1, false);
  220. var strData = logfile.ReadAll();
  221. logfile.Close();
  222. var obj = eval(strData);
  223. DumpObject(obj, 99);
  224. Pub.innerHTML = g_strDump;
  225. }
  226. catch(ex)
  227. {
  228. Pub.innerHTML = '';
  229. }
  230. }
  231. function DumpObject(obj, maxdepth)
  232. {
  233. var TreeResult = DumpObjectWorker(obj, maxdepth);
  234. var str = UndumpTree(TreeResult);
  235. g_strDump = str;
  236. }
  237. function UndumpTree(tree)
  238. {
  239. var str = '';
  240. for(var index = 0; index < tree.length; ++index)
  241. {
  242. if (typeof(tree[index]) == 'object')
  243. {
  244. str += UndumpTree(tree[index]);
  245. }
  246. else
  247. str += tree[index];
  248. }
  249. return str;
  250. }
  251. function DumpObjectWorker(obj, maxdepth)
  252. {
  253. var fHasChildren;
  254. var j;
  255. var i;
  256. var result;
  257. var tree = new Array();
  258. var index = 0;
  259. if (maxdepth == 0)
  260. {
  261. tree[index] = '<I>Maximum Depth reached</I><BR>';
  262. return tree;
  263. }
  264. for (i in obj)
  265. {
  266. if (typeof(obj[i]) == 'object')
  267. {
  268. fHasChildren = false;
  269. for (j in obj[i])
  270. {
  271. if (j != 'length')
  272. {
  273. fHasChildren = true;
  274. break;
  275. }
  276. }
  277. if (!fHasChildren)
  278. {
  279. tree[index++] = '<STRONG>' + i + '</STRONG> (empty)<BR>';
  280. }
  281. else
  282. {
  283. tree[index++] = '<SPAN> <B onclick="toggle(this)">' + i + '</B><BR><DIV id=quote style="display:none;margin-left:3em">';
  284. result = DumpObjectWorker(obj[i], maxdepth-1);
  285. tree[index++] = result;
  286. tree[index++] = '</DIV></SPAN>';
  287. }
  288. }
  289. else if (typeof(obj[i]) == 'string')
  290. {
  291. tree[index++] = '' + i + ' = "' + obj[i] + '"<BR>';
  292. }
  293. else
  294. {
  295. tree[index++] = '' + i + ' = ' + obj[i] + '<BR>';
  296. }
  297. }
  298. return tree;
  299. }
  300. function toggle(obj) { with (obj.parentElement.children("quote").style) { if (display=="none") display=""; else display="none"; }}
  301. //======================================================================================================
  302. /*
  303. function DumpObject(obj, maxdepth)
  304. {
  305. var TreeResult = DumpObjectWorker(obj, maxdepth);
  306. g_strDump = UndumpTree(TreeResult);
  307. }
  308. function UndumpTree(tree)
  309. {
  310. var str = '';
  311. for(var index = 0; index < tree.length; ++index)
  312. {
  313. if (typeof(tree[index]) == 'object')
  314. {
  315. str += UndumpTree(tree[index]);
  316. }
  317. else
  318. str += tree[index];
  319. }
  320. return str;
  321. }
  322. function DumpObjectWorker(obj, maxdepth)
  323. {
  324. var fHasChildren;
  325. var j;
  326. var i;
  327. var result;
  328. var tree = new Array();
  329. var index = 0;
  330. if (maxdepth == 0)
  331. {
  332. tree[index] = '<I>Maximum Depth reached</I><BR>';
  333. return tree;
  334. }
  335. for (i in obj)
  336. {
  337. if (typeof(obj[i]) == 'object')
  338. {
  339. fHasChildren = false;
  340. for (j in obj[i])
  341. {
  342. if (j == 'length')
  343. {
  344. fHasChildren = true;
  345. break;
  346. }
  347. }
  348. if (!fHasChildren)
  349. {
  350. tree[index++] = '<STRONG>' + i + '</STRONG> (empty)<BR>';
  351. }
  352. else
  353. {
  354. tree[index++] = '<SPAN> <B onclick="toggle(this)">' + i + '</B><BR><DIV id=quote style="display:none;margin-left:3em">';
  355. result = DumpObjectWorker(obj[i], maxdepth-1);
  356. tree[index++] = result;
  357. tree[index++] = '</DIV></SPAN>';
  358. }
  359. }
  360. else if (typeof(obj[i]) == 'string')
  361. {
  362. tree[index++] = '' + i + ' = "' + obj[i] + '"<BR>';
  363. }
  364. else
  365. {
  366. tree[index++] = '' + i + ' = ' + obj[i] + '<BR>';
  367. }
  368. }
  369. return tree;
  370. }*/
  371. /*function DumpObject(obj, maxdepth)
  372. {
  373. if (maxdepth == 0)
  374. return;
  375. for (i in obj)
  376. {
  377. if (typeof(obj[i]) == 'object')
  378. {
  379. g_strDump += '<B>' + i + '</B><BLOCKQUOTE>';
  380. DumpObject(obj[i], maxdepth-1);
  381. g_strDump += '</BLOCKQUOTE>';
  382. }
  383. else
  384. {
  385. g_strDump += i + ' = "' + obj[i] + '"<BR>';
  386. }
  387. }
  388. }
  389. */
  390. </SCRIPT>
  391. <SCRIPT for=RemoteObj event="OnScriptNotify(arg1, arg2)" language=JavaScript>
  392. try
  393. {
  394. Notify.insertAdjacentHTML('beforeEnd', '<B>Notify(' + arg1 + ', ' + arg2 + ')</B><BR>');
  395. if (arg1 == 'UpdatePublicData')
  396. {
  397. DumpData();
  398. }
  399. }
  400. catch(ex)
  401. {
  402. // Ignore errors
  403. }
  404. </SCRIPT>
  405. <SCRIPT for=RemoteObjWorker event="OnScriptNotify(arg1, arg2)" language=JavaScript>
  406. try
  407. {
  408. }
  409. catch(ex)
  410. {
  411. // Ignore errors
  412. }
  413. </SCRIPT>
  414. </HEAD>
  415. <BODY>
  416. Machine (leave blank for local machine): <INPUT type=text id=machname>
  417. <INPUT type=button value="Connect" onclick="ErrorCheck('Connect()')">
  418. <INPUT type=button value="Disconnect" onclick="ErrorCheck('Disconnect()')">
  419. <INPUT type=button value="Init" onclick="ErrorCheck('Init()')" style="width:5em">
  420. <TABLE>
  421. <TR>
  422. <INPUT type=button value="SetMode master" onclick="ErrorCheck('SetMode(\'master\')')" style="width:8em">
  423. <INPUT type=button value="SetMode slave" onclick="ErrorCheck('SetMode(\'slave\')')" style="width:8em">
  424. <INPUT type=button value="SetMode test" onclick="ErrorCheck('SetMode(\'test\')')" style="width:8em">
  425. <INPUT type=button value="SetMode idle" onclick="ErrorCheck('SetMode(\'idle\')')" style="width:8em">
  426. </TABLE>
  427. <P>
  428. Command: <INPUT type=text id=cmd> &nbsp;&nbsp;
  429. Args: <INPUT type=text id=args>
  430. <INPUT type=button value="Send" onclick="ErrorCheck('SendExec()')">
  431. <hr>
  432. <TABLE width=100%>
  433. <TR>
  434. <TD valign=top ROWSPAN=2>
  435. <INPUT type=button value="Clear Output" onclick="Output.innerHTML='';Notify.innerHTML='';">
  436. <P>
  437. <SPAN id=Output></SPAN>
  438. </TD>
  439. <TD valign=top>
  440. <SPAN id=Notify></SPAN>
  441. </TD>
  442. </TR>
  443. <TR>
  444. <TD valign=top>
  445. <INPUT type=button value="Exit All Edsel" onclick="ErrorCheck('ExitAllProc()')">
  446. <INPUT type=button value="Connect All Edsel" onclick="ErrorCheck('ConnectAllProc()')">
  447. <INPUT type=button value="View PD Log" onclick="ErrorCheck('ViewPDLog()')">
  448. <INPUT type=button value="Dump PublicData" onclick="ErrorCheck('DumpData()')">
  449. <INPUT type=button value="Dump PrivateData" onclick="ErrorCheck('DumpDataPrivate()')">
  450. <P>
  451. <DIV id=Pub></DIV>
  452. </TD>
  453. </TR>
  454. </TABLE>
  455. <OBJECT id=RemoteObj
  456. CLASSID="clsid:854c3182-c854-4a77-b189-606859e4391b">
  457. </OBJECT>
  458. <OBJECT id=RemoteObjWorker
  459. CLASSID="clsid:854c3182-c854-4a77-b189-606859e4391b">
  460. </OBJECT>
  461. <!-- License object which allows us to us the common dialog OCX -->
  462. <object CLASSID="clsid:5220cb21-c88d-11cf-b347-00aa00a28331" VIEWASTEXT>
  463. <param NAME="LPKPath" VALUE="comdlg.lpk">
  464. </object>
  465. <!-- The common dialog OCX -->
  466. <object classid="clsid:F9043C85-F6F2-101A-A3C9-08002B2F49FB" codeBase="controls/comdlg32.ocx#version=6,0,84,18" id="comdlg" style="LEFT: 0px; TOP: 0px" VIEWASTEXT>
  467. <param NAME="_ExtentX" VALUE="847">
  468. <param NAME="_ExtentY" VALUE="847">
  469. <param NAME="_Version" VALUE="393216">
  470. <param NAME="CancelError" VALUE="0">
  471. <param NAME="Color" VALUE="0">
  472. <param NAME="Copies" VALUE="1">
  473. <param NAME="DefaultExt" VALUE>
  474. <param NAME="DialogTitle" VALUE>
  475. <param NAME="FileName" VALUE>
  476. <param NAME="Filter" VALUE>
  477. <param NAME="FilterIndex" VALUE="0">
  478. <param NAME="Flags" VALUE="0">
  479. <param NAME="FontBold" VALUE="0">
  480. <param NAME="FontItalic" VALUE="0">
  481. <param NAME="FontName" VALUE>
  482. <param NAME="FontSize" VALUE="8">
  483. <param NAME="FontStrikeThru" VALUE="0">
  484. <param NAME="FontUnderLine" VALUE="0">
  485. <param NAME="FromPage" VALUE="0">
  486. <param NAME="HelpCommand" VALUE="0">
  487. <param NAME="HelpContext" VALUE="0">
  488. <param NAME="HelpFile" VALUE>
  489. <param NAME="HelpKey" VALUE>
  490. <param NAME="InitDir" VALUE>
  491. <param NAME="Max" VALUE="0">
  492. <param NAME="Min" VALUE="0">
  493. <param NAME="MaxFileSize" VALUE="260">
  494. <param NAME="PrinterDefault" VALUE="1">
  495. <param NAME="ToPage" VALUE="0">
  496. <param NAME="Orientation" VALUE="1"></object>
  497. </BODY>
  498. </HTML>