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.

67 lines
2.0 KiB

  1. //////////////////////////////////////////////////////
  2. // This script modifies two files as follows:
  3. //
  4. // 1. \windows\inf\sysoc.inf : Replaces the string "uddiocm.dll" with "uddiocmtest.dll"
  5. // This allows the update of UDDI with private bits
  6. //
  7. // 2. \windows\inf\uddi.inf : Replaces the string ",,,\i386" with ",,,"
  8. // This causes the install to prompt for the location of setup files
  9. //
  10. //////////////////////////////////////////////////////
  11. var g_shell = WScript.CreateObject("WScript.Shell");
  12. var g_env = g_shell.Environment("process");
  13. var g_fso = new ActiveXObject("Scripting.FileSystemObject");
  14. // get folder where windows is installed
  15. var windir = g_env("WINDIR");
  16. WScript.Echo("UDDI Services INF file patch utility\n");
  17. SearchAndReplace("uddiocm.dll", "uddiocmtest.dll", windir + "\\inf\\sysoc.inf");
  18. SearchAndReplace(",,,\\i386", ",,,\\BROWSE", windir + "\\inf\\uddi.inf");
  19. //========================================================
  20. function SearchAndReplace(findstr, repstr, filename)
  21. {
  22. var f1, data, data2;
  23. // make sure file exists
  24. if (g_fso.FileExists(filename))
  25. {
  26. f1 = g_fso.OpenTextFile(filename, 1);
  27. data = f1.ReadAll();
  28. f1.Close();
  29. if (data.indexOf(findstr) != -1)
  30. {
  31. data2 = data.replace(findstr, repstr);
  32. f1 = g_fso.CreateTextFile(filename, 2);
  33. f1.WriteLine(data2);
  34. f1.Close();
  35. WScript.Echo("File patched successfully: " + filename);
  36. }
  37. else
  38. {
  39. // check if previously patched
  40. if(data.indexOf(repstr) != -1)
  41. {
  42. WScript.Echo("No changes done. File was previously patched : " + filename);
  43. }
  44. else
  45. {
  46. // neither was the file previously patched, nor is the search string to
  47. // be found... definitely some error
  48. WScript.Echo("Search string not found. Unable to patch file: " + filename);
  49. }
  50. }
  51. }
  52. else
  53. {
  54. WScript.Echo("File not found: " + filename);
  55. }
  56. }