home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1996 February / VPR9602A.ISO / i386 / registry.in_ / registry.inf
INI File  |  1995-10-25  |  43KB  |  985 lines

  1. [RegistryConstants]
  2.     MaskAllAccess          = 33554432
  3.     NoTitle                = 0
  4.     RegLastError           = $(!REG_ERROR_SUCCESS)
  5. [WinNTKeyCreate]
  6.     set Status = STATUS_FAILED
  7.     read-syms RegistryConstants
  8.     set KeyPath   = { +
  9.                      {SOFTWARE,       $(NoTitle), $(MaskAllAccess)}, +
  10.                      {Microsoft,      $(NoTitle), $(MaskAllAccess)}, +
  11.                      {"Windows NT",      $(NoTitle), $(MaskAllAccess)}, +
  12.                      {CurrentVersion, $(NoTitle), $(MaskAllAccess)}  +
  13.                     }
  14.     ifstr(i) $(!STF_NTUPGRADE) == "YES"
  15.         set KeyValues = { +
  16.                          {PathName,               $(NoTitle), $(!REG_VT_SZ),    *($($0), 1) },       +
  17.                          {SoftwareType,           $(NoTitle), $(!REG_VT_SZ),    *($($0), 2) },       +
  18.                          {InstallDate,            $(NoTitle), $(!REG_VT_DWORD), *(*($($0), 5), 1) }, +
  19.                          {SourcePath,             $(NoTitle), $(!REG_VT_SZ),    *($($0), 7) },       +
  20.                          {ProductId,              $(NoTitle), $(!REG_VT_SZ),    *($($0), 8) }        +
  21.                         }
  22.     else
  23.         set KeyValues = { +
  24.                          {PathName,               $(NoTitle), $(!REG_VT_SZ),    *($($0), 1) },       +
  25.                          {SoftwareType,           $(NoTitle), $(!REG_VT_SZ),    *($($0), 2) },       +
  26.                          {RegisteredOwner,        $(NoTitle), $(!REG_VT_SZ),    *($($0), 3) },       +
  27.                          {RegisteredOrganization, $(NoTitle), $(!REG_VT_SZ),    *($($0), 4) },       +
  28.                          {InstallDate,            $(NoTitle), $(!REG_VT_DWORD), *(*($($0), 5), 1) }, +
  29.                          {SourcePath,             $(NoTitle), $(!REG_VT_SZ),    *($($0), 7) },       +
  30.                          {ProductId,              $(NoTitle), $(!REG_VT_SZ),    *($($0), 8) }        +
  31.                         }
  32.     endif
  33.     shell "" CreateKey $(!REG_H_LOCAL) $(KeyPath) $(KeyValues)
  34.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  35.         goto endWinNT
  36.     endif
  37.     ifstr(i) $($R0) != STATUS_SUCCESSFUL
  38.         goto endWinNT
  39.     else
  40.         CloseRegKey $($R1)
  41.     endif
  42.     set KeyPath   = { +
  43.                      {System,             $(NoTitle), $(MaskAllAccess)}, +
  44.                      {$(!STF_CONTROLSET), $(NoTitle), $(MaskAllAccess)}, +
  45.                      {Control,            $(NoTitle), $(MaskAllAccess)}, +
  46.                      {ProductOptions,     $(NoTitle), $(MaskAllAccess)}  +
  47.                     }
  48.     set KeyValues = { +
  49.                      {ProductType,        $(NoTitle), $(!REG_VT_SZ), *($($0), 6) } +
  50.                     }
  51.     shell "" CreateKey $(!REG_H_LOCAL) $(KeyPath) $(KeyValues)
  52.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  53.         goto endWinNT
  54.     endif
  55.     ifstr(i) $($R0) != STATUS_SUCCESSFUL
  56.         goto endWinNT
  57.     else
  58.         CloseRegKey $($R1)
  59.     endif
  60.     ifstr(i) $(!STF_NTUPGRADE) != "YES"
  61.         ifstr(i) *($($0), 6) != "WinNT"
  62.             set KeyPath   = { +
  63.                              {System,             $(NoTitle), $(MaskAllAccess)}, +
  64.                              {$(!STF_CONTROLSET), $(NoTitle), $(MaskAllAccess)}, +
  65.                              {Control,            $(NoTitle), $(MaskAllAccess)}, +
  66.                              {"Session Manager",  $(NoTitle), $(MaskAllAccess)}  +
  67.                             }
  68.             set KeyValues = { +
  69.                              {RegisteredProcessors, $(NoTitle), $(!REG_VT_DWORD), 4 } +
  70.                             }
  71.             shell "" CreateKey $(!REG_H_LOCAL) $(KeyPath) $(KeyValues)
  72.             ifint $($ShellCode) != $(!SHELL_CODE_OK)
  73.                 goto endWinNT
  74.             endif
  75.             ifstr(i) $($R0) != STATUS_SUCCESSFUL
  76.                 goto endWinNT
  77.             else
  78.                 CloseRegKey $($R1)
  79.             endif
  80.         endif
  81.     endif
  82.     set Status = STATUS_SUCCESSFUL
  83. endWinNT = +
  84.     Return $(Status)
  85. [WinNTAddPid]
  86.     set Status = STATUS_FAILED
  87.     read-syms RegistryConstants
  88.     set KeyPath   = { +
  89.                      {SOFTWARE,       $(NoTitle), $(MaskAllAccess)}, +
  90.                      {Microsoft,      $(NoTitle), $(MaskAllAccess)}, +
  91.                      {"Windows NT",   $(NoTitle), $(MaskAllAccess)}, +
  92.                      {CurrentVersion, $(NoTitle), $(MaskAllAccess)}  +
  93.                     }
  94.     set KeyValues = { +
  95.                      {ProductId,      $(NoTitle), $(!REG_VT_SZ), *($($0), 1) }        +
  96.                     }
  97.     shell "" CreateKey $(!REG_H_LOCAL) $(KeyPath) $(KeyValues)
  98.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  99.         goto endWinNTAdd
  100.     endif
  101.     ifstr(i) $($R0) != STATUS_SUCCESSFUL
  102.         goto endWinNTAdd
  103.     else
  104.         CloseRegKey $($R1)
  105.     endif
  106.     set Status = STATUS_SUCCESSFUL
  107. endWinNTAdd = +
  108.     Return $(Status)
  109. [MakeStartupEntry]
  110.     set Status = STATUS_FAILED
  111.     read-syms RegistryConstants
  112.     set KeyPath   = { +
  113.                      {SOFTWARE,          $(NoTitle), $(MaskAllAccess)}, +
  114.                      {Microsoft,         $(NoTitle), $(MaskAllAccess)}, +
  115.                      {"Windows NT",      $(NoTitle), $(MaskAllAccess)}, +
  116.                      {CurrentVersion,    $(NoTitle), $(MaskAllAccess)}, +
  117.                      {"Program Manager", $(NoTitle), $(MaskAllAccess)}, +
  118.                      {Settings,          $(NoTitle), $(MaskAllAccess)}  +
  119.                     }
  120.     set KeyValues = { +
  121.                      {Startup, $(NoTitle), $(!REG_VT_SZ), $($0)} +
  122.                     }
  123.     shell "" CreateKey $(!REG_H_CUSER) $(KeyPath) $(KeyValues)
  124.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  125.         goto end_MakeStartupEntry
  126.     endif
  127.     ifstr(i) $($R0) != STATUS_SUCCESSFUL
  128.         goto end_MakeStartupEntry
  129.     else
  130.         CloseRegKey $($R1)
  131.     endif
  132.     set Status = STATUS_SUCCESSFUL
  133. end_MakeStartupEntry = +
  134.     Return $(Status)
  135. [GetNTSource]
  136.     set Status = STATUS_SUCCESSFUL
  137.     read-syms RegistryConstants
  138.     set NTSource = A:\
  139.     set KeyName = "Software\Microsoft\Windows NT\CurrentVersion"
  140.     OpenRegKey $(!REG_H_LOCAL) "" $(KeyName) $(!REG_KEY_READ) KeyHandle
  141.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  142.         Debug-Output "REGISTRY.INF: Couldn't open windows nt software key for read access"
  143.         goto end_getntsource
  144.     endif
  145.     GetRegValue $(KeyHandle) "SourcePath" SourcePathValue
  146.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  147.         CloseRegKey $(KeyHandle)
  148.         goto end_getntsource
  149.     endif
  150.     set NTSource =  *($(SourcePathValue), 4)
  151.     CloseRegKey $(KeyHandle)
  152. end_getntsource = +
  153.     Return $(Status) $(NTSource)
  154. [AppendToBootExecute]
  155.     set Status           = STATUS_FAILED
  156.     set AppendLines      = $($0)
  157.     read-syms RegistryConstants
  158.     set KeyName = "System\"$(!STF_CONTROLSET)"\Control\Session Manager"
  159.     OpenRegKey $(!REG_H_LOCAL) "" $(KeyName) $(MaskAllAccess) KeyHandle
  160.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  161.         Debug-Output "REGISTRY.INF: Couldn't open session manager node for read/write access"
  162.         goto finish_appendbootexecute
  163.     endif
  164.     GetRegValue $(KeyHandle) "BootExecute" BootExecuteValue
  165.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  166.         set BootExecute = {}
  167.     else
  168.         set BootExecute = *($(BootExecuteValue), 4)
  169.     endif
  170.     set NewBootExecute = {}
  171.     ForListDo $(BootExecute)
  172.         set NewBootExecute = >($(NewBootExecute), $($))
  173.     EndForListDo
  174.     ForListDo $(AppendLines)
  175.         set NewBootExecute = >($(NewBootExecute), $($))
  176.     EndForListDo
  177.     set ValueInfo = {BootExecute, $(NoTitle), $(!REG_VT_MULTI_SZ), $(NewBootExecute)}
  178.     SetRegValue $(KeyHandle) $(ValueInfo)
  179.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  180.         CloseRegKey $(KeyHandle)
  181.         Debug-Output "REGISTRY.INF: Couldn't set BootExecute value"
  182.         goto finish_appendbootexecute
  183.     endif
  184.     CloseRegKey $(KeyHandle)
  185.     set Status = STATUS_SUCCESSFUL
  186. finish_appendbootexecute = +
  187.     Return $(Status)
  188. [AppendToSystemPath]
  189.     set Status           = STATUS_FAILED
  190.     read-syms RegistryConstants
  191.     set KeyName = "System\"$(!STF_CONTROLSET)"\Control\Session Manager\Environment"
  192.     OpenRegKey $(!REG_H_LOCAL) "" $(KeyName) $(MaskAllAccess) KeyHandle
  193.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  194.         Debug-Output "REGISTRY.INF: Couldn't open session manager\environment node for read/write access"
  195.         goto finish_appendsystempath0
  196.     endif
  197.     GetRegValue $(KeyHandle) "Path" PathValue
  198.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  199.         goto finish_appendsystempath1
  200.     endif
  201.     set NewPathValue = *($(PathValue),4)";"$($0)
  202.     set ValueInfo = {"Path", $(NoTitle), $(!REG_VT_EXPAND_SZ), $(NewPathValue)}
  203.     SetRegValue $(KeyHandle) $(ValueInfo)
  204.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  205.         Debug-Output "REGISTRY.INF: Couldn't set Path value"
  206.         goto finish_appendsystempath1
  207.     endif
  208.     set Status = STATUS_SUCCESSFUL
  209. finish_appendsystempath1 = +
  210.     CloseRegKey $(KeyHandle)
  211. finish_appendsystempath0 = +
  212.     Return $(Status)
  213. [EnumeratePagingFiles]
  214.     set Status       = STATUS_FAILED
  215.     set PagingFiles  = {}
  216.     read-syms RegistryConstants
  217.     set KeyName = "System\"$(!STF_CONTROLSET)"\Control\Session Manager\Memory Management"
  218.     OpenRegKey $(!REG_H_LOCAL) "" $(KeyName) $(!REG_KEY_READ) KeyHandle
  219.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  220.         Debug-Output "REGISTRY.INF: Couldn't open pagefile node for read access"
  221.         goto endenumpagefile
  222.     endif
  223.     GetRegValue $(KeyHandle) "PagingFiles" PagingFilesValue
  224.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  225.         Debug-Output "REGISTRY.INF: Couldn't read PagingFiles value"
  226.         CloseRegKey $(KeyHandle)
  227.         goto endenumpagefile
  228.     endif
  229.     CloseRegKey $(KeyHandle)
  230.     ifstr(i) $(PagingFilesValue) == ""
  231.         set Status = STATUS_SUCCESSFUL
  232.         goto endenumpagefile
  233.     endif
  234.     set PagefileList = *($(PagingFilesValue), 4)
  235.     ForListDo $(PagefileList)
  236.        ifstr(i) $($) != ""
  237.            set Pagefile = $($)
  238.            Split-String $(Pagefile) " " SplitString
  239.            set PagefilePath  = ""
  240.            set PagefileSize  = ""
  241.            ForListDo $(SplitString)
  242.               ifstr(i) $($) != " "
  243.                  ifstr(i) $(PagefilePath) == ""
  244.                      set PagefilePath = $($)
  245.                  else-ifstr(i) $(PagefileSize) == ""
  246.                      set PagefileSize = $($)
  247.                  endif
  248.               endif
  249.            EndForListDo
  250.            ifstr(i) $(PagefilePath) == ""
  251.            else-ifstr(i) $(PagefileSize) == ""
  252.            else
  253.                set PagingFiles = >($(PagingFiles), {$(PagefilePath),$(PagefileSize)})
  254.            endif
  255.        endif
  256.     EndForListDo
  257.     set Status = STATUS_SUCCESSFUL
  258. endenumpagefile = +
  259.     Return $(Status) $(PagingFiles)
  260. [SetPagingFiles]
  261.     set Status       = STATUS_FAILED
  262.     set PagingFiles  = {}
  263.     read-syms RegistryConstants
  264.     set KeyName = "System\"$(!STF_CONTROLSET)"\Control\Session Manager\Memory Management"
  265.     OpenRegKey $(!REG_H_LOCAL) "" $(KeyName) $(MaskAllAccess) KeyHandle
  266.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  267.         goto endsetpagingfiles
  268.     endif
  269.     set PagefileList = {}
  270.     ForListDo $($0)
  271.         set PagefileList = >($(PagefileList), *($($), 1)" "*($($), 2) )
  272.     EndForListDo
  273.     Debug-Output "REGISTRY.INF: New Paging files are "$(PagefileList)
  274.     set ValueInfo = {PagingFiles, $(NoTitle), $(!REG_VT_MULTI_SZ), $(PagefileList)}
  275.     SetRegValue $(KeyHandle) $(ValueInfo)
  276.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  277.         CloseRegKey $(KeyHandle)
  278.         Debug-Output "REGISTRY.INF: Couldn't set paging files value"
  279.         goto endsetpagingfiles
  280.     endif
  281.     CloseRegKey $(KeyHandle)
  282.     set Status = STATUS_SUCCESSFUL
  283. endsetpagingfiles = +
  284.     Return $(Status)
  285. [MakeQuotaEntries]
  286.     set Status       = STATUS_FAILED
  287.     read-syms RegistryConstants
  288.     set PagedPoolSize     = $($0)
  289.     set RegistrySizeLimit = $($1)
  290.     set MBMultiplier  = 1024
  291.     set-mul MBMultiplier  = $(MBMultiplier) 1024
  292.     set-mul PagedPoolSize     = $(PagedPoolSize)     $(MBMultiplier)
  293.     set-mul RegistrySizeLimit = $(RegistrySizeLimit) $(MBMultiplier)
  294.     set KeyName = "System\"$(!STF_CONTROLSET)"\Control\Session Manager\Memory Management"
  295.     OpenRegKey $(!REG_H_LOCAL) "" $(KeyName) $(MaskAllAccess) KeyHandle
  296.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  297.         Debug-Output "REGISTRY.INF: Couldn't open memory management key"
  298.         goto end_MakeQuotaEntries
  299.     endif
  300.     set ValueInfo = {PagedPoolSize, $(NoTitle), $(!REG_VT_DWORD), $(PagedPoolSize)}
  301.     SetRegValue $(KeyHandle) $(ValueInfo)
  302.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  303.         CloseRegKey $(KeyHandle)
  304.         Debug-Output "REGISTRY.INF: Couldn't set pagepoolsize value"
  305.         goto end_MakeQuotaEntries
  306.     endif
  307.     CloseRegKey $(KeyHandle)
  308.     set KeyName = "System\"$(!STF_CONTROLSET)"\Control"
  309.     OpenRegKey $(!REG_H_LOCAL) "" $(KeyName) $(MaskAllAccess) KeyHandle
  310.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  311.         Debug-Output "REGISTRY.INF: Couldn't open control key"
  312.         goto end_MakeQuotaEntries
  313.     endif
  314.     set ValueInfo = {RegistrySizeLimit, $(NoTitle), $(!REG_VT_DWORD), $(RegistrySizeLimit)}
  315.     SetRegValue $(KeyHandle) $(ValueInfo)
  316.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  317.         CloseRegKey $(KeyHandle)
  318.         Debug-Output "REGISTRY.INF: Couldn't set registry size limit value"
  319.         goto end_MakeQuotaEntries
  320.     endif
  321.     CloseRegKey $(KeyHandle)
  322.     set Status = STATUS_SUCCESSFUL
  323. end_MakeQuotaEntries = +
  324.     Return $(Status)
  325. [MakeWOWEntry]
  326.     set Status = STATUS_FAILED
  327.     read-syms  RegistryConstants
  328.     OpenRegKey $(!REG_H_LOCAL) "" "system\"$(!STF_CONTROLSET)"\control\WOW" $(MaskAllAccess) WOWKey
  329.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  330.         Debug-Output "REGISTRY.INF: Failed to open layout key"
  331.         goto finish_MakeWOWEntry
  332.     endif
  333.     set wowcmdline = "ntvdm -m -w -f%SystemRoot%\system32 -a %SystemRoot%\system32\"$($0)
  334.     set KeyValues = { +
  335.                     {wowcmdline,   $(NoTitle), $(!REG_VT_EXPAND_SZ), $(wowcmdline)}  +
  336.                     }
  337.     shell "" AddValueList $(WOWKey) $(KeyValues)
  338.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  339.         goto finish_MakeWOWEntry
  340.     endif
  341.     ifstr(i) $($R0) != STATUS_SUCCESSFUL
  342.         goto finish_MakeWOWEntry
  343.     endif
  344.     CloseRegKey $(WOWKey)
  345.     set Status = STATUS_SUCCESSFUL
  346. finish_MakeWOWEntry = +
  347.     Return $(Status)
  348. [MakeLayoutEntry]
  349.     set Status = STATUS_FAILED
  350.     read-syms  RegistryConstants
  351.     OpenRegKey $(!REG_H_LOCAL) "" "system\"$(!STF_CONTROLSET)"\control\Keyboard Layout" $(MaskAllAccess) LayoutKey
  352.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  353.         Debug-Output "REGISTRY.INF: Failed to open layout key"
  354.         goto finish_MakeLayoutEntry
  355.     endif
  356.     set KeyValues = { +
  357.                       {$($0),   $(NoTitle), $(!REG_VT_SZ), $($1)       }  +
  358.                     }
  359.     shell "" AddValueList $(LayoutKey) $(KeyValues)
  360.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  361.         goto finish_MakeLayoutEntry
  362.     endif
  363.     ifstr(i) $($R0) != STATUS_SUCCESSFUL
  364.         goto finish_MakeLayoutEntry
  365.     endif
  366.     CloseRegKey $(LayoutKey)
  367.     LibraryProcedure STATUS, $(!LIBHANDLE), SetCurrentLayout $($0)
  368.     ifstr(i) $(STATUS) != "SUCCESS"
  369.         Debug-Output "REGISTRY.INF: Failed in SetCurrentLayout function"
  370.         goto finish_MakeLayoutEntry
  371.     endif
  372.     set Status = STATUS_SUCCESSFUL
  373. finish_MakeLayoutEntry = +
  374.     Return $(Status)
  375. [MakeLocaleEntry]
  376.     set Status = STATUS_FAILED
  377.     read-syms  RegistryConstants
  378.     ifstr(i) $($1) != "locale.nls"
  379.         OpenRegKey $(!REG_H_LOCAL) "" "system\"$(!STF_CONTROLSET)"\control\nls\OEMLocale" $(MaskAllAccess) OEMLocaleKey
  380.         ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  381.             Debug-Output "REGISTRY.INF: Failed to open OEMLocale key"
  382.             goto finish_MakeLocaleEntry
  383.         endif
  384.         set KeyValues = { +
  385.                           {$($0), $(NoTitle), $(!REG_VT_SZ), $($1)}  +
  386.                         }
  387.         shell "" AddValueList $(OEMLocaleKey) $(KeyValues)
  388.         ifint $($ShellCode) != $(!SHELL_CODE_OK)
  389.             Debug-Output "REGISTRY.INF: Failed to find function AddValueList"
  390.             goto finish_MakeLocaleEntry
  391.         endif
  392.         ifstr(i) $($R0) != STATUS_SUCCESSFUL
  393.             Debug-Output "REGISTRY.INF: Failed to create OEMLocale value"
  394.             goto finish_MakeLocaleEntry
  395.         endif
  396.         CloseRegKey $(OEMLocaleKey)
  397.     endif
  398.     ifstr(i) $(!STF_INSTALL_TYPE) == SETUPBOOTED
  399.         set ModifyCPL = YES
  400.     else
  401.         set ModifyCPL = NO
  402.     endif
  403.     LibraryProcedure STATUS, $(!LIBHANDLE), SetCurrentLocale $($0) $(ModifyCPL)
  404.     ifstr(i) $(STATUS) != "SUCCESS"
  405.         ifstr(i) $(STATUS) == ERROR_UNSUPPORTED
  406.             set Status = ERROR_UNSUPPORTED
  407.         endif
  408.         Debug-Output "REGISTRY.INF: Failed in SetCurrentLocale function"
  409.         goto finish_MakeLocaleEntry
  410.     endif
  411.     OpenRegKey $(!REG_H_CUSER) "" "Control Panel\International" $(MaskAllAccess) LocaleKey
  412.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  413.         Debug-Output "REGISTRY.INF: Failed to open cuser international key"
  414.         goto finish_MakeLocaleEntry
  415.     endif
  416.     set KeyValues = { +
  417.                       {Locale, $(NoTitle), $(!REG_VT_SZ), $($0)        } +
  418.                     }
  419.     shell "" AddValueList $(LocaleKey) $(KeyValues)
  420.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  421.         Debug-Output "REGISTRY.INF: Failed to find function AddValueList"
  422.         CloseRegKey $(LocaleKey)
  423.         goto finish_MakeLocaleEntry
  424.     endif
  425.     ifstr(i) $($R0) != STATUS_SUCCESSFUL
  426.         Debug-Output "REGISTRY.INF: Failed to create Current User Locale value"
  427.         CloseRegKey $(LocaleKey)
  428.         goto finish_MakeLocaleEntry
  429.     endif
  430.     set KeyValues = {}
  431.     set Num = 1
  432.     ForListDo $($2)
  433.         set KeyValues = >($(KeyValues), {$(Num), $(NoTitle), $(!REG_VT_SZ), $($)})
  434.     EndForListDo
  435.     set KeyPath = {{"Sorting Order", $(NoTitle), $(MaskAllAccess)}}
  436.     shell "" CreateKey $(LocaleKey) $(KeyPath) $(KeyValues)
  437.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  438.         CloseRegKey $(LocaleKey)
  439.         goto finish_MakeLocaleEntry
  440.     endif
  441.     ifstr(i) $($R0) != STATUS_SUCCESSFUL
  442.         CloseRegKey $(LocaleKey)
  443.         goto finish_MakeLocaleEntry
  444.     else
  445.         CloseRegKey $($R1)
  446.     endif
  447.     CloseRegKey $(LocaleKey)
  448.     set Status = STATUS_SUCCESSFUL
  449. finish_MakeLocaleEntry = +
  450.     Return $(Status)
  451. [MakeLanguageEntry]
  452.     set Status = STATUS_FAILED
  453.     read-syms  RegistryConstants
  454.     OpenRegKey $(!REG_H_LOCAL) "" "system\"$(!STF_CONTROLSET)"\control\nls\Language" $(MaskAllAccess) LanguageKey
  455.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  456.         Debug-Output "REGISTRY.INF: Failed to open Language key"
  457.         goto finish_MakeLanguageEntry
  458.     endif
  459.     set KeyValues = { +
  460.                       {Default, $(NoTitle), $(!REG_VT_SZ), $($0)       }, +
  461.                       {$($0),   $(NoTitle), $(!REG_VT_SZ), $($1)       }  +
  462.                     }
  463.     shell "" AddValueList $(LanguageKey) $(KeyValues)
  464.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  465.         goto finish_MakeLanguageEntry
  466.     endif
  467.     ifstr(i) $($R0) != STATUS_SUCCESSFUL
  468.         goto finish_MakeLanguageEntry
  469.     endif
  470.     CloseRegKey $(LanguageKey)
  471.     set Status = STATUS_SUCCESSFUL
  472. finish_MakeLanguageEntry = +
  473.     Return $(Status)
  474. [MakeCodePageEntry]
  475.     set Status = STATUS_FAILED
  476.     read-syms  RegistryConstants
  477.     OpenRegKey $(!REG_H_LOCAL) "" "system\"$(!STF_CONTROLSET)"\control\nls\CodePage" $(MaskAllAccess) CodePageKey
  478.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  479.         Debug-Output "REGISTRY.INF: Failed to open CodePage key"
  480.         goto finish_MakeCodePageEntry
  481.     endif
  482.     set KeyValues = { +
  483.                       {ACP,   $(NoTitle), $(!REG_VT_SZ), $($0) }, +
  484.                       {OEMCP, $(NoTitle), $(!REG_VT_SZ), $($2) }, +
  485.                       {MACCP, $(NoTitle), $(!REG_VT_SZ), $($4) }, +
  486.                       {$($0), $(NoTitle), $(!REG_VT_SZ), $($1) }, +
  487.                       {$($2), $(NoTitle), $(!REG_VT_SZ), $($3) }, +
  488.                       {$($4), $(NoTitle), $(!REG_VT_SZ), $($5) }, +
  489.                       {OEMHAL,$(NoTitle), $(!REG_VT_SZ), $($8) }  +
  490.                     }
  491.     ForListDo $($6)
  492.        set CodePageValue = {$($), $(NoTitle), $(!REG_VT_SZ), *($($7), $(#)) }
  493.        set KeyValues = >($(KeyValues), $(CodePageValue))
  494.     EndForListDo
  495.     shell "" AddValueList $(CodePageKey) $(KeyValues)
  496.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  497.         goto finish_MakeCodePageEntry
  498.     endif
  499.     ifstr(i) $($R0) != STATUS_SUCCESSFUL
  500.         goto finish_MakeCodePageEntry
  501.     endif
  502.     CloseRegKey $(CodePageKey)
  503.     set Status = STATUS_SUCCESSFUL
  504. finish_MakeCodePageEntry = +
  505.     Return $(Status)
  506. [MakeFontEntries]
  507.     set Status = STATUS_FAILED
  508.     read-syms  RegistryConstants
  509.     set OemFontFile   = $($0)
  510.     set WoaFontFile   = $($1)
  511.     set Cga40FontFile = $($2)
  512.     set Cga80FontFile = $($3)
  513.     set Ega40FontFile = $($4)
  514.     set Ega80FontFile = $($5)
  515.     set FixFontFile   = $($6)
  516.     set SysFontFile   = $($7)
  517.     set MSShellDlgFontFile = $($8)
  518.     set DlgFontFileNameFile = $($9)
  519.     set TaggedFontName = $($10)
  520.     set CourFontFile = $($11)
  521.     set SerifFontFile = $($12)
  522.     set SmallFontFile = $($13)
  523.     install Install-Ini-Font-Alter
  524.     ifstr(i) $(STF_INSTALL_OUTCOME) == "STF_FAILURE"
  525.         goto finish_MakeFontEntries
  526.     endif
  527.     set Status = STATUS_SUCCESSFUL
  528. finish_MakeFontEntries = +
  529.     Return $(Status)
  530. [Install-Ini-Font-Alter]
  531.     ReplaceIniKeyValue "win.ini",    GRE_Initialize,   "OEMFONT.FON",  $(OemFontFile)
  532.     ReplaceIniKeyValue "system.ini", boot.description, "oemfonts.fon", $(OemFontFile)
  533.     ReplaceIniKeyValue "system.ini", 386Enh,           "woafont",      $(WoaFontFile)
  534.     ReplaceIniKeyValue "system.ini", 386Enh,           "CGA40WOA.FON", $(Cga40FontFile)
  535.     ReplaceIniKeyValue "system.ini", 386Enh,           "CGA80WOA.FON", $(Cga80FontFile)
  536.     ReplaceIniKeyValue "system.ini", 386Enh,           "EGA40WOA.FON", $(Ega40FontFile)
  537.     ReplaceIniKeyValue "system.ini", 386Enh,           "EGA80WOA.FON", $(Ega80FontFile)
  538.     ReplaceIniKeyValue "win.ini",    GRE_Initialize,   "FIXEDFON.FON",  $(FixFontFile)
  539.     ReplaceIniKeyValue "win.ini",    GRE_Initialize,   "FONTS.FON",  $(SysFontFile)
  540.     ReplaceIniKeyValue "win.ini",    FontSubstitutes,  "MS Shell Dlg",  $(MSShellDlgFontFile)
  541.     ReplaceIniKeyValue "win.ini",    Fonts, "MS Sans Serif 8,10,12,14,18,24 (VGA res)",  $(DlgFontFileNameFile)
  542.     ReplaceIniKeyValue "win.ini",    Fonts, "Courier 10,12,15 (VGA res)",  $(CourFontFile)
  543.     ReplaceIniKeyValue "win.ini",    Fonts, "MS Serif 8,10,12,14,18,24 (VGA res)",  $(SerifFontFile)
  544.     ReplaceIniKeyValue "win.ini",    Fonts, "Small Fonts (VGA res)",  $(SmallFontFile)
  545.     ifstr(i) $(TaggedFontName) == ""
  546.         RemoveIniKey   "win.ini",    FontSubstitutes,  "Arial TRK"
  547.         RemoveIniKey   "win.ini",    FontSubstitutes,  "Courier New TRK"
  548.         RemoveIniKey   "win.ini",    FontSubstitutes,  "Times New Roman TRK"
  549.         RemoveIniKey   "win.ini",    FontSubstitutes,  "Arial CE"
  550.         RemoveIniKey   "win.ini",    FontSubstitutes,  "Courier New CE"
  551.         RemoveIniKey   "win.ini",    FontSubstitutes,  "Times New Roman CE"
  552.         RemoveIniKey   "win.ini",    FontSubstitutes,  "Arial CYR"
  553.         RemoveIniKey   "win.ini",    FontSubstitutes,  "Courier New CYR"
  554.         RemoveIniKey   "win.ini",    FontSubstitutes,  "Times New Roman CYR"
  555.         RemoveIniKey   "win.ini",    FontSubstitutes,  "Arial Greek"
  556.         RemoveIniKey   "win.ini",    FontSubstitutes,  "Courier New Greek"
  557.         RemoveIniKey   "win.ini",    FontSubstitutes,  "Times New Roman Greek"
  558.     endif
  559.     ifstr(i) $(TaggedFontName) == "CE"
  560.         ReplaceIniKeyValue "win.ini" FontSubstitutes,  "Arial CE", "Arial"
  561.         ReplaceIniKeyValue "win.ini" FontSubstitutes,  "Courier New CE", "Courier New"
  562.         ReplaceIniKeyValue "win.ini" FontSubstitutes,  "Times New Roman CE", "Times New Roman"
  563.         ReplaceIniKeyValue "win.ini" FontSubstitutes,  "Arial CYR", "Arial"
  564.         ReplaceIniKeyValue "win.ini" FontSubstitutes,  "Courier New CYR", "Courier New"
  565.         ReplaceIniKeyValue "win.ini" FontSubstitutes,  "Times New Roman CYR", "Times New Roman"
  566.     endif
  567.     ifstr(i) $(TaggedFontName) == "CYR"
  568.         ReplaceIniKeyValue "win.ini" FontSubstitutes,  "Arial CYR", "Arial"
  569.         ReplaceIniKeyValue "win.ini" FontSubstitutes,  "Courier New CYR", "Courier New"
  570.         ReplaceIniKeyValue "win.ini" FontSubstitutes,  "Times New Roman CYR", "Times New Roman"
  571.         ReplaceIniKeyValue "win.ini" FontSubstitutes,  "Arial CE", "Arial"
  572.         ReplaceIniKeyValue "win.ini" FontSubstitutes,  "Courier New CE", "Courier New"
  573.         ReplaceIniKeyValue "win.ini" FontSubstitutes,  "Times New Roman CE", "Times New Roman"
  574.     endif
  575.     ifstr(i) $(TaggedFontName) == "Greek"
  576.         ReplaceIniKeyValue "win.ini" FontSubstitutes,  "Arial Greek", "Arial"
  577.         ReplaceIniKeyValue "win.ini" FontSubstitutes,  "Courier New Greek", "Courier New"
  578.         ReplaceIniKeyValue "win.ini" FontSubstitutes,  "Times New Roman Greek", "Times New Roman"
  579.     endif
  580.     ifstr(i) $(TaggedFontName) == "TRK"
  581.         ReplaceIniKeyValue "win.ini" FontSubstitutes,  "Arial TRK", "Arial"
  582.         ReplaceIniKeyValue "win.ini" FontSubstitutes,  "Courier New TRK", "Courier New"
  583.         ReplaceIniKeyValue "win.ini" FontSubstitutes,  "Times New Roman TRK", "Times New Roman"
  584.     endif
  585.     exit
  586. [MakeServicesEntry]
  587.     set Status = STATUS_FAILED
  588.     read-syms RegistryConstants
  589.     Debug-Output "REGISTRY.INF: Creating Services node: "$($0)
  590.     OpenRegKey $(!REG_H_LOCAL) "" "system\"$(!STF_CONTROLSET)"\services" $(MaskAllAccess) ServicesKey
  591.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  592.         Debug-Output "REGISTRY.INF: Failed to open services key"
  593.         goto finish_MakeServicesEntry
  594.     endif
  595.     set StandardSet = { Type,           +
  596.                         Start,          +
  597.                         ErrorControl,   +
  598.                         Group,          +
  599.                         Dependencies,   +
  600.                         StartName,      +
  601.                         Password,       +
  602.                         BinaryPathName, +
  603.                         DisplayName     +
  604.                       }
  605.     ForListDo $(StandardSet)
  606.         set $($) = ""
  607.     EndForListDo
  608.     set KeyValues = {}
  609.     ForListDo $($1)
  610.        set Var   = *($($), 1)
  611.        set Value = *($($), 4)
  612.        ifcontains(i) $(Var) in $(StandardSet)
  613.            set $(Var) = $(Value)
  614.        else
  615.            set KeyValues = >($(KeyValues), $($))
  616.        endif
  617.     EndForListDo
  618.     set Error = NO
  619.     ForListDo { Type, Start, ErrorControl, BinaryPathName }
  620.         ifstr(i) $($($)) == ""
  621.             set Error = YES
  622.         endif
  623.     EndForListDo
  624.     ifstr(i) $(Error) == YES
  625.         Debug-Output "REGISTRY.INF: MakeServicesEntry was not passed in one of the three values: Type, Start, ErrorControl"
  626.         CloseRegKey $(ServicesKey)
  627.         goto finish_MakeServicesEntry
  628.     endif
  629.     set ServiceName = $($0)
  630.     LibraryProcedure STATUS, $(!LIBHANDLE), SetupCreateService $(ServiceName)      +
  631.                                                                $(DisplayName)      +
  632.                                                                $(Type)             +
  633.                                                                $(Start)            +
  634.                                                                $(ErrorControl)     +
  635.                                                                $(BinaryPathName)   +
  636.                                                                $(Group)            +
  637.                                                                $(Dependencies)     +
  638.                                                                $(StartName)        +
  639.                                                                $(Password)
  640.     ifstr(i) $(STATUS) != "SUCCESS"
  641.         Debug-Output "REGISTRY.INF: MakeServicesEntry: SetupCreateService function failed"
  642.         CloseRegKey $(ServicesKey)
  643.         goto finish_MakeServicesEntry
  644.     endif
  645.     set KeyPath   = {{$($0), $(NoTitle), $(MaskAllAccess)}}
  646.     shell "" CreateKey $(ServicesKey) $(KeyPath) $(KeyValues)
  647.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  648.         Debug-Output "REGISTRY.INF: Failed to shell CreateKey."
  649.         CloseRegKey $(ServicesKey)
  650.         goto error_MakeServicesEntry
  651.     endif
  652.     ifstr(i) $($R0) != STATUS_SUCCESSFUL
  653.         Debug-Output "REGISTRY.INF: Failed to create services node."
  654.         CloseRegKey $(ServicesKey)
  655.         goto error_MakeServicesEntry
  656.     endif
  657.     set MiniportKey = $($R1)
  658.     ifstr(i) $($2) != ""
  659.         set KeyPath   = {{$($5), $(NoTitle), $(MaskAllAccess)}}
  660.         set KeyValues = $($2)
  661.         shell "" CreateKey $(MiniportKey) $(KeyPath) $(KeyValues)
  662.         ifint $($ShellCode) != $(!SHELL_CODE_OK)
  663.             CloseRegKey $(ServicesKey)
  664.             CloseRegKey $(MiniportKey)
  665.             goto error_MakeServicesEntry
  666.         endif
  667.         ifstr(i) $($R0) != STATUS_SUCCESSFUL
  668.             CloseRegKey $(ServicesKey)
  669.             CloseRegKey $(MiniportKey)
  670.             goto error_MakeServicesEntry
  671.         endif
  672.         set ParametersKey = $($R1)
  673.         ForListDo $($3)
  674.             set-sub DeviceNum = $(#) 1
  675.             set EntryName = "Device"$(DeviceNum)
  676.             set KeyPath   = {{$(EntryName), $(NoTitle), $(MaskAllAccess)}}
  677.             set KeyValues = $($3)
  678.             shell "" CreateKey $(ParametersKey) $(KeyPath) $(KeyValues)
  679.             ifint $($ShellCode) != $(!SHELL_CODE_OK)
  680.                 CloseRegKey $(ServicesKey)
  681.                 CloseRegKey $(MiniportKey)
  682.                 CloseRegKey $(ParametersKey)
  683.                 goto error_MakeServicesEntry
  684.             endif
  685.             ifstr(i) $($R0) != STATUS_SUCCESSFUL
  686.                 CloseRegKey $(ServicesKey)
  687.                 CloseRegKey $(MiniportKey)
  688.                 CloseRegKey $(ParametersKey)
  689.                 goto error_MakeServicesEntry
  690.             endif
  691.             CloseRegKey $($R1)
  692.         EndForListDo
  693.         CloseRegKey $(ParametersKey)
  694.     endif
  695.     CloseRegKey $(MiniportKey)
  696.     ifstr(i) $($4) != {}
  697.         OpenRegKey $(ServicesKey) "" "eventlog\system" $(MaskAllAccess) EventLogKey
  698.         ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  699.             Debug-Output "REGISTRY.INF: Failed to open eventlog key"
  700.             CloseRegKey $(ServicesKey)
  701.             goto error_MakeServicesEntry
  702.         endif
  703.         set KeyPath   = {{$($0), $(NoTitle), $(MaskAllAccess)}}
  704.         set KeyValues = $($4)
  705.         shell "" CreateKey $(EventLogKey) $(KeyPath) $(KeyValues)
  706.         ifint $($ShellCode) != $(!SHELL_CODE_OK)
  707.             CloseRegKey $(ServicesKey)
  708.             CloseRegKey $(EventLogKey)
  709.             goto error_MakeServicesEntry
  710.         endif
  711.         ifstr(i) $($R0) != STATUS_SUCCESSFUL
  712.             CloseRegKey $(ServicesKey)
  713.             CloseRegKey $(EventLogKey)
  714.             goto error_MakeServicesEntry
  715.         endif
  716.         CloseRegKey $($R1)
  717.         CloseRegKey $(EventLogKey)
  718.     endif
  719.     CloseRegKey $(ServicesKey)
  720.     set Status = STATUS_SUCCESSFUL
  721.     goto finish_MakeServicesEntry
  722. error_MakeServicesEntry = +
  723.     shell "" ModifyServicesEntry $($0) $(!SERVICE_DISABLED)
  724. finish_MakeServicesEntry = +
  725.     Return $(Status)
  726. [GetServicesEntryStart]
  727.     set Status     = STATUS_FAILED
  728.     set StartValue = ""
  729.     read-syms RegistryConstants
  730.     Debug-Output "REGISTRY.INF: Get Services node Start value: "$($0)
  731.     set KeyName = "system\"$(!STF_CONTROLSET)"\services\"$($0)
  732.     OpenRegKey $(!REG_H_LOCAL) "" $(KeyName) $(!REG_KEY_READ) KeyHandle
  733.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  734.         Debug-Output "REGISTRY.INF: Couldn't open services node for read access"
  735.         goto finish_GetServicesEntryStart
  736.     endif
  737.     GetRegValue $(KeyHandle) "Start" StartValueList
  738.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  739.         Debug-Output "REGISTRY.INF: Couldn't read Start value"
  740.         CloseRegKey $(KeyHandle)
  741.         goto finish_GetServicesEntryStart
  742.     endif
  743.     CloseRegKey $(KeyHandle)
  744.     set StartValue = *($(StartValueList), 4)
  745.     set Status = STATUS_SUCCESSFUL
  746. finish_GetServicesEntryStart = +
  747.     Return $(Status) $(StartValue)
  748. [RemoveServicesEntry]
  749.     set Status = STATUS_FAILED
  750.     read-syms RegistryConstants
  751.     Debug-Output "REGISTRY.INF: Removing Services node: "$($0)
  752.     shell "" ModifyServicesEntry $($0) $(!SERVICE_DISABLED)
  753.     Return $($R0)
  754. [MakeSetupKey]
  755.     set Status = STATUS_FAILED
  756.     read-syms  RegistryConstants
  757.     OpenRegKey $(!REG_H_LOCAL) "" "system\"$(!STF_CONTROLSET)"\control" $(MaskAllAccess) ControlKey
  758.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  759.         Debug-Output "REGISTRY.INF: Failed to open services key"
  760.         goto finish_MakeSetupKey
  761.     endif
  762.     set KeyPath   = { +
  763.                      {"Setup", $(NoTitle), $(MaskAllAccess)} +
  764.                     }
  765.     set KeyValues = {}
  766.     shell "" CreateKey $(ControlKey) $(KeyPath) $(KeyValues)
  767.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  768.         CloseRegKey $(ControlKey)
  769.         goto finish_MakeSetupKey
  770.     endif
  771.     ifstr(i) $($R0) != STATUS_SUCCESSFUL
  772.         CloseRegKey $(ControlKey)
  773.         goto finish_MakeSetupKey
  774.     endif
  775.     CloseRegKey $($R1)
  776.     CloseRegKey $(ControlKey)
  777.     set Status = STATUS_SUCCESSFUL
  778. finish_MakeSetupKey = +
  779.     Return $(Status)
  780. [CheckSetupModify]
  781.     set Status = STATUS_FAILED
  782.     read-syms  RegistryConstants
  783.     LibraryProcedure STATUS, $(!LIBHANDLE), TestAdmin
  784.     ifstr(i) $(STATUS) == "YES"
  785.         set Status = STATUS_SUCCESSFUL
  786.     endif
  787.     Return $(Status)
  788. [MakeSetupOptionEntry]
  789.     set Status = STATUS_FAILED
  790.     read-syms  RegistryConstants
  791.     OpenRegKey $(!REG_H_LOCAL) "" "system\"$(!STF_CONTROLSET)"\control" $(MaskAllAccess) ControlKey
  792.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  793.         Debug-Output "REGISTRY.INF: Failed to open services key"
  794.         goto finish_MakeSetupOptionEntry
  795.     endif
  796.     set KeyPath   = { +
  797.                      {"Setup", $(NoTitle), $(MaskAllAccess)} +
  798.                     }
  799.     set KeyValues = { +
  800.                       {$($0), $(NoTitle), $(!REG_VT_SZ), $($1)} +
  801.                     }
  802.     shell "" CreateKey $(ControlKey) $(KeyPath) $(KeyValues)
  803.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  804.         CloseRegKey $(ControlKey)
  805.         goto finish_MakeSetupOptionEntry
  806.     endif
  807.     ifstr(i) $($R0) != STATUS_SUCCESSFUL
  808.         CloseRegKey $(ControlKey)
  809.         goto finish_MakeSetupOptionEntry
  810.     endif
  811.     CloseRegKey $($R1)
  812.     CloseRegKey $(ControlKey)
  813.     set Status = STATUS_SUCCESSFUL
  814. finish_MakeSetupOptionEntry = +
  815.     Return $(Status)
  816. [ResetSetupProgressValue]
  817.     set Status = STATUS_FAILED
  818.     read-syms  RegistryConstants
  819.     OpenRegKey $(!REG_H_LOCAL) "" "system\setup" $(MaskAllAccess) SetupKey
  820.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  821.         Debug-Output "REGISTRY.INF: Failed to open Setup key"
  822.         goto finish_ResetSetupProgressValue
  823.     endif
  824.     set ValueInfo = {SystemSetupInProgress, $(NoTitle), $(!REG_VT_DWORD), 0}
  825.     SetRegValue $(SetupKey) $(ValueInfo)
  826.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  827.         CloseRegKey $(SetupKey)
  828.         Debug-Output "REGISTRY.INF: Couldn't set SystemSetupInProgress value"
  829.         goto finish_ResetSetupProgressValue
  830.     endif
  831.     ifstr(i) $(!STF_NTUPGRADE) == "YES"
  832.         set ValueInfo = {UpgradeInProgress, $(NoTitle), $(!REG_VT_DWORD), 0}
  833.         SetRegValue $(SetupKey) $(ValueInfo)
  834.         ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  835.             CloseRegKey $(SetupKey)
  836.             Debug-Output "REGISTRY.INF: Couldn't set UpgradeInProgress value"
  837.             goto finish_ResetSetupProgressValue
  838.         endif
  839.     endif
  840.     CloseRegKey $(SetupKey)
  841.     set Status = STATUS_SUCCESSFUL
  842. finish_ResetSetupProgressValue = +
  843.     Return $(Status)
  844. [ModifyServicesEntry]
  845.     read-syms RegistryConstants
  846.     set Status = STATUS_FAILED
  847.     set StartValue = $($1)
  848.     LibraryProcedure STATUS, $(!LIBHANDLE), SetupChangeServiceStart $($0) $(StartValue)
  849.     ifstr(i) $(STATUS) != "SUCCESS"
  850.         Debug-Output "REGISTRY.INF: ModifyServicesEntry: SetupChangeServiceStart function failed"
  851.         goto finish_ModifyServicesEntry
  852.     endif
  853.     set Status = STATUS_SUCCESSFUL
  854. finish_ModifyServicesEntry = +
  855.     Return $(Status)
  856. [CreateKey]
  857.     set Status = STATUS_FAILED
  858.     read-syms RegistryConstants
  859.     set BaseHandle = $($0)
  860.     set KeyHandle  = $(BaseHandle)
  861.     ForListDo $($1)
  862.         set KeyInfo = $($)
  863.         set KeyName = *($(KeyInfo), 1)
  864.         OpenRegKey $(BaseHandle) "" $(KeyName) $(MaskAllAccess) KeyHandle
  865.         ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  866.             Debug-Output "REGISTRY.INF: Key"$(KeyName)"doesn't exist.  Will create key"
  867.             set RegLastError = 0
  868.             CreateRegKey $(BaseHandle) $(KeyInfo) "" $(MaskAllAccess) "" KeyHandle
  869.             ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  870.                 set Status = STATUS_ERROR_CREATEKEY
  871.                 Debug-Output "REGISTRY.INF: Error in creating key"
  872.                 goto endcreate
  873.             endif
  874.         endif
  875.         ifstr(i) $(BaseHandle) != $($0)
  876.             CloseRegKey $(BaseHandle)
  877.             ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  878.                 set Status = STATUS_ERROR_CREATEKEY
  879.                 Debug-Output "REGISTRY.INF: Error in closing base handle"
  880.                 goto endcreate
  881.             endif
  882.         endif
  883.         set BaseHandle = $(KeyHandle)
  884.     EndForListDo
  885.     ifstr(i) $($2) != {}
  886.         shell "" AddValueList $(KeyHandle) $($2)
  887.         ifstr(i) $($R0) != STATUS_SUCCESSFUL
  888.             set Status = STATUS_ERROR_CREATEVALUE
  889.             goto endcreate
  890.         endif
  891.     endif
  892.     set Status = STATUS_SUCCESSFUL
  893. endcreate = +
  894.     ifstr(i) $(Status) != STATUS_SUCCESSFUL
  895.         Debug-Output "REGISTRY.INF: CreateKey Error:"$(Status)
  896.     endif
  897.     Return $(Status) $(KeyHandle)
  898. [AddValueList]
  899.    set Status = STATUS_FAILED
  900.    read-syms RegistryConstants
  901.    ForListDo $($1)
  902.        SetRegValue $($0) $($)
  903.        ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  904.            Debug-Output "REGISTRY.INF: CreateValue failed:"$($)
  905.            goto end_addvaluelist
  906.        endif
  907.    EndForListDo
  908.    set Status = STATUS_SUCCESSFUL
  909. end_addvaluelist = +
  910.    return $(Status)
  911. [EnableCrashDump]
  912.     OpenRegKey $(!REG_H_LOCAL) "" system\currentcontrolset\control\CrashControl $(!REG_KEY_SET_VALUE) CrashControlKey
  913.     ifstr $(CrashControlKey) != ""
  914.         shell "" AddValueList $(CrashControlKey) {{LogEvent        ,0,$(!REG_VT_DWORD),1},+
  915.                                                   {SendAlert       ,0,$(!REG_VT_DWORD),1},+
  916.                                                   {CrashDumpEnabled,0,$(!REG_VT_DWORD),1},+
  917.                                                   {AutoReboot      ,0,$(!REG_VT_DWORD),1}}
  918.         CloseRegKey $(CrashControlKey)
  919.     endif
  920.     return
  921. [FixQuotaEntries]
  922.     set Status       = STATUS_SUCCESSFUL
  923.     read-syms RegistryConstants
  924.     set OldPagedPoolSize = 0
  925.     set OldRegistrySizeLimit = 0
  926.     set NewPagedPoolSize     = 0
  927.     set NewRegistrySizeLimit = 0
  928.     set BogusPagedPoolSize     = 48
  929.     set BogusRegistrySizeLimit = 24
  930.     set MBMultiplier  = 1024
  931.     set-mul MBMultiplier  = $(MBMultiplier) 1024
  932.     set-mul BogusPagedPoolSize     = $(BogusPagedPoolSize)     $(MBMultiplier)
  933.     set-mul BogusRegistrySizeLimit = $(BogusRegistrySizeLimit) $(MBMultiplier)
  934.     set KeyName = "System\"$(!STF_CONTROLSET)"\Control\Session Manager\Memory Management"
  935.     OpenRegKey $(!REG_H_LOCAL) "" $(KeyName) $(MaskAllAccess) KeyHandle
  936.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  937.         Debug-Output "REGISTRY.INF: Couldn't open memory management key"
  938.         set Status = STATUS_FAILED
  939.         goto fix_next_entry
  940.     endif
  941.     GetRegValue $(KeyHandle) "PagedPoolSize" OldPagedPoolSizeInfo
  942.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  943.         Debug-Output "REGISTRY.INF: Couldn't read PagedPoolSize value"
  944.         set Status = STATUS_FAILED
  945.         goto close_first_handle
  946.     endif
  947.     set OldPagedPoolSize = *($(OldPagedPoolSizeInfo), 4)
  948.     ifint $(OldPagedPoolSize) == $(BogusPagedPoolSize)
  949.         set ValueInfo = {PagedPoolSize, $(NoTitle), $(!REG_VT_DWORD), $(NewPagedPoolSize)}
  950.         SetRegValue $(KeyHandle) $(ValueInfo)
  951.         ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  952.             set Status = STATUS_FAILED
  953.             Debug-Output "REGISTRY.INF: Couldn't set PagePoolSize value"
  954.         endif
  955.     endif
  956. close_first_handle = +
  957.     CloseRegKey $(KeyHandle)
  958. fix_next_entry = +
  959.     set KeyName = "System\"$(!STF_CONTROLSET)"\Control"
  960.     OpenRegKey $(!REG_H_LOCAL) "" $(KeyName) $(MaskAllAccess) KeyHandle
  961.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  962.         set Status = STATUS_FAILED
  963.         Debug-Output "REGISTRY.INF: Couldn't open control key"
  964.         goto end_FixQuotaEntries
  965.     endif
  966.     GetRegValue $(KeyHandle) "RegistrySizeLimit" OldRegistrySizeLimitInfo
  967.     ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  968.         Debug-Output "REGISTRY.INF: Couldn't read RegistrySizeLimit value"
  969.         set Status = STATUS_FAILED
  970.         goto close_second_handle
  971.     endif
  972.     set OldRegistrySizeLimit = *($(OldRegistrySizeLimitInfo), 4)
  973.     ifint $(OldRegistrySizeLimit) == $(BogusRegistrySizeLimit)
  974.         set ValueInfo = {RegistrySizeLimit, $(NoTitle), $(!REG_VT_DWORD), $(RegistrySizeLimit)}
  975.         SetRegValue $(KeyHandle) $(ValueInfo)
  976.         ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  977.             set Status = STATUS_FAILED
  978.             Debug-Output "REGISTRY.INF: Couldn't set RegistrySizeLimit value"
  979.         endif
  980.     endif
  981. close_second_handle = +
  982.     CloseRegKey $(KeyHandle)
  983. end_FixQuotaEntries = +
  984.     Return $(Status)
  985.