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