Jump to content


Photo

NSIS Registry key writing


  • Please log in to reply
15 replies to this topic

#1 FReQuEnZy

FReQuEnZy

    Retired

  • Members
  • PipPipPipPipPipPipPip
  • 7986 posts

Posted 20 February 2012 - 05:46 AM

I'm trying to make a ra2 optimizer/patcher. That modifies the ra2.ini and ra2md.ini's and also adds optimal network and multimedia class scheduler settings into the registry.

I've gone through many guides on this and I can't seem to get the installer to write to the correct registry keys.
I'm using the Nullsoft Install system.


I'm trying to write to the following keys.
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile]
"NetworkThrottlingIndex"=dword:ffffffff
"SystemResponsiveness"=dword:00000000

[HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]
"DeadGWDetectDefault"=dword:00000001
"DefaultTTL"=dword:00000040
"DisableTaskOffload"=dword:00000001
"EnableDca"=dword:00000000
"EnableICMPRedirect"=dword:00000001
"MaxUserPort"=dword:0000ffff
"SynAttackProtect"=dword:00000001
"SyncDomainWithMembership"=dword:00000001
"Tcp1323Opts"=dword:00000001
"TCPMaxDataRetransmissions"=dword:00000007
"TcpTimedWaitDelay"=dword:0000001e
"UseDomainNameDevolution"=dword:00000001

[HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Tcpip\ServiceProvider]
"Class" 0x00000008
"DnsPriority"=dword:00000006
"HostsPriority"=dword:00000005
"LocalPriority"=dword:00000004
"NetbtPriority"=dword:00000007

[HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Dnscache]
"ErrorControl"=dword:00000001
"MaxNegativeCacheTtl"=dword:00000000
"NegativeCacheTime"=dword:00000000
"NegativeSOACacheTime"=dword:00000000
"NetFailureCacheTime"=dword:00000000
"ServiceDllUnloadOnStop"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games]
"Scheduling Category"="High"
"SFIO Priority"="High"
"Background Only"="False"
"Priority"=dword:00000001
"Clock Rate"=dword:00002710
"GPU Priority"=dword:00000001
"Affinity"=dword:00000000


Edited by FReQuEnZy, 20 February 2012 - 05:48 AM.


#2 Melodyn

Melodyn

    Seal

  • Banned
  • PipPipPipPip
  • 331 posts

Posted 20 February 2012 - 03:06 PM

What have you tried? This isn't really a NSIS support forum or an outsourcing company. Have you even looked at the reference?

WriteINIStr: http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.2.13
WriteRegDWORD: http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.2.15
WriteRegStr: http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.2.16

The counterparts for reading are documented a few points above them (they are called "Read" instead of "Write").

BTW, I don't think enabling "SynAttackProtect" for a client system makes a lot of sense.

#3 FReQuEnZy

FReQuEnZy

    Retired

  • Members
  • PipPipPipPipPipPipPip
  • 7986 posts

Posted 20 February 2012 - 05:30 PM

I already tried those commands and the registry writer plug in as well.

The registry keys remain to be unmodified. I also tried to save the entries in a reg file and tried to launch the file after installation.

#4 Melodyn

Melodyn

    Seal

  • Banned
  • PipPipPipPip
  • 331 posts

Posted 20 February 2012 - 05:54 PM

They're called functions. And you're not modifying keys but values.

Can you post some examples? I brought my crystall ball to the repair shop the other day...

Some of your problems may have to do with registry virtualization. HKLM\SOFTWARE will definitely be redirected for your NSIS installer, however I'm sure you can work around that problem, try asking google.

Should you manage to get it done, whichever way that happens to be. Please take backups before modifying anything.

#5 FReQuEnZy

FReQuEnZy

    Retired

  • Members
  • PipPipPipPipPipPipPip
  • 7986 posts

Posted 20 February 2012 - 06:34 PM


outFile "Red Alert 2 Optimizer.exe"



RequestExecutionLevel admin

InstallDirRegKey HKLM "Software\Westwood\Red Alert 2" "InstallPath"

section "Tweaks"

    setOutPath $INSTDIR



AccessControl::GrantOnFile \

"$INSTDIR" "(BU)" "GenericWrite" 



WriteINIStr $INSTDIR\Ra2.ini Video VideoBackBuffer no

WriteINIStr $INSTDIR\Ra2.ini Video AllowVRAMSidebar yes

WriteINIStr $INSTDIR\Ra2.ini SerialDefaults Baud 115200



WriteINIStr $INSTDIR\Ra2md.ini Video VideoBackBuffer no

WriteINIStr $INSTDIR\Ra2md.ini Video AllowVRAMSidebar yes

WriteINIStr $INSTDIR\Ra2md.ini SerialDefaults Baud 115200



AccessControl::GrantOnRegKey \

HKLM "Software" "(BU)" "FullAccess"

WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games" "Scheduling Category" "High"

WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games" "SFIO Priority" "High"

WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games" "Background Only" "False"

WriteRegDWORD HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile" "NetworkThrottlingIndex" 0xffffffff

WriteRegDWORD HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile" "SystemResponsiveness" 0x0

WriteRegDWORD HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games" "Priority" 0x1

WriteRegDWORD HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games" "Clock Rate" 0x2710

WriteRegDWORD HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games" "GPU Priority" 0x1

WriteRegDWORD HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games" "Affinity" 0x0

AccessControl::GrantOnRegKey \

HKLM "System" "(BU)" "FullAccess"



WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" "DeadGWDetectDefault" 0x1

WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" "DefaultTTL" 0x40

WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" "DisableTaskOffload" 0x1

WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" "EnableDca" 0x0

WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" "MaxUserPort" 0xffff

WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" "SynAttackProtect" 0x1

WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" "SyncDomainWithMembership" 0x1

WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" "Tcp1323Opts" 0x1

WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" "TCPMaxDataRetransmissions" 0x7

WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" "TcpTimedWaitDelay" 0x1e

WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" "UseDomainNameDevolution" 0x1

WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Tcpip\ServiceProvider" "Class" 0x8

WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Tcpip\ServiceProvider" "DnsPriority" 0x6

WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Tcpip\ServiceProvider" "HostsPriority" 0x5

WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Tcpip\ServiceProvider" "LocalPriority" 0x4

WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Tcpip\ServiceProvider" "NetbtPriority" 0x7

WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Dnscache" "ErrorControl" 0x1

WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Dnscache" "MaxNegativeCacheTtl" 0x0

WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Dnscache" "NegativeCacheTime" 0x0

WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Dnscache" "NegativeSOACacheTime" 0x0

WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Dnscache" "NetFailureCacheTime" 0x0

WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\Dnscache" "ServiceDllUnloadOnStop" 0x1

   

sectionEnd



#6 Olaf

Olaf

    Commander

  • XWIS Admin
  • PipPipPipPipPipPipPipPip
  • 13446 posts
  • XWIS Name: XTF

Posted 20 February 2012 - 06:41 PM

I don't think this is a good idea. Changing all those values might cause unknown issues. Also, a lot of the values seem unrelated to RA2 performance.

#7 FReQuEnZy

FReQuEnZy

    Retired

  • Members
  • PipPipPipPipPipPipPip
  • 7986 posts

Posted 20 February 2012 - 08:22 PM

The registry values are some of the gaming tweaks I've used.

The first bunch of entires change settings for the Microsoft multimedia class scheduler to prioritize gaming related processing. :)
Giving all the processes a higher priority thus increasing Windows 7 gaming performance on all games.

The second bunch of entires are related to the TCP Optimizer tool. They tweak internet connection parameters for a more responsive connection gaming wise.
Lowering latency and general ping. Also all these settings have been tried and tested by many gamers with very good results.

Most of them were suggested to increase performance in Counter-Strike Source which is a multiplayer First person shooter.
The game was unplayable before I added these tweaks.


All these values will affect RA2 performance very directly, especially the network tweaks.

Edited by FReQuEnZy, 20 February 2012 - 08:23 PM.


#8 Melodyn

Melodyn

    Seal

  • Banned
  • PipPipPipPip
  • 331 posts

Posted 20 February 2012 - 09:01 PM

Fireworks said that enabling "AllowVRAMSidebar" does no good for him, so I wouldn't do it: http://xwis.net/forums/index.php/topic/172199-my-resolution-picker-tool/page__view__findpost__p__1478660

For me "GPU Priority" is set to 8. Do you have any reference/documentation on what those values mean/effect?

1. You don't need this AccessControl:: stuff.
2. Jesus, use a macro.
!define games "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games"
WriteRegStr HKLM "${games}" "Scheduling Category" "High"
WriteRegStr HKLM "${games}" "SFIO Category" "High"
3. Try enclosing all strings into double quotes for some consistency.

I agree with Olaf, what you're doing is dangerous and doesn't really seem particularly targeted. Therefore rather leave it. Otherwise backups are a must, unless you accept the fact you may cripple other peoples systems...

#9 FReQuEnZy

FReQuEnZy

    Retired

  • Members
  • PipPipPipPipPipPipPip
  • 7986 posts

Posted 20 February 2012 - 09:24 PM

Fireworks said that enabling "AllowVRAMSidebar" does no good for him, so I wouldn't do it: http://xwis.net/forums/index.php/topic/172199-my-resolution-picker-tool/page__view__findpost__p__1478660

For me "GPU Priority" is set to 8. Do you have any reference/documentation on what those values mean/effect?

I agree with Olaf, what you're doing is dangerous and doesn't really seem particularly targeted.



His case is the only one I have seen in years, where the AllowVRAMSidebar settings has caused lag for him.
IMO there's a error somewhere on his system. In 99% of the cases the setting is useful.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms684247%28v=vs.85%29.aspx

These settings are safe and very useful to increasing multiplayer gaming performance.
I use these and a LOT more of optimizations on my own PC, these are the safest and most reasonable, due to the increase in performance.


!define games "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games"
WriteRegStr HKLM "${games}" "Scheduling Category" "High"
WriteRegStr HKLM "${games}" "SFIO Category" "High"

How does this make any difference what so ever? The registry keys are still not being modified.

Edited by FReQuEnZy, 20 February 2012 - 09:38 PM.


#10 Melodyn

Melodyn

    Seal

  • Banned
  • PipPipPipPip
  • 331 posts

Posted 20 February 2012 - 09:51 PM

!define games "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games"
WriteRegStr HKLM "${games}" "Scheduling Category" "High"
WriteRegStr HKLM "${games}" "SFIO Category" "High"

How does this make any difference what so ever? The registry keys are still not being modified.

I didn't say it would make any difference whatsoever, it was merely a suggestion for you. NSIS installers are 32-bit binaries. If a 32-bit binary on an 64-bit system accesses HKLM\SOFTWARE it is actually redirected to HKLM\SOFTWARE\Wow6432Node which is why you may see no changes where you perhaps are looking for them.

#11 Olaf

Olaf

    Commander

  • XWIS Admin
  • PipPipPipPipPipPipPipPip
  • 13446 posts
  • XWIS Name: XTF

Posted 20 February 2012 - 09:55 PM

All these values will affect RA2 performance very directly, especially the network tweaks.

Do you have any idea of what they do exactly?

#12 FReQuEnZy

FReQuEnZy

    Retired

  • Members
  • PipPipPipPipPipPipPip
  • 7986 posts

Posted 20 February 2012 - 11:14 PM

Yes, there's lenghty article on all of them here.
http://www.speedguide.net/articles/windows-7-vista-2008-tweaks-2574

I modified the most significant keys with TCP Optimizer and then used it's internal registry editor in combination with that guide to make these tweaks.

#13 Melodyn

Melodyn

    Seal

  • Banned
  • PipPipPipPip
  • 331 posts

Posted 20 February 2012 - 11:29 PM

You're tampering with more than that in the link, besides I think it's correct to say that the stuff seems to be targeted at Windows Server 2008 more than client versions even if it's not mentioned.

FYI, changing anything TCP related won't directly improve gaming experience, since the game doesn't use TCP for anything other than connections to the server which are completely irrelevant to game-play.

#14 FReQuEnZy

FReQuEnZy

    Retired

  • Members
  • PipPipPipPipPipPipPip
  • 7986 posts

Posted 20 February 2012 - 11:33 PM

All your internet traffic is affected by the TCP settings and I've noticed a big increase on many multiplayer games.

#15 PostNextOlaf

PostNextOlaf

    Captain

  • Members
  • PipPipPipPipPipPip
  • 1680 posts
  • XWIS Name: yid

Posted 20 February 2012 - 11:59 PM

TCP.jpg

#16 FReQuEnZy

FReQuEnZy

    Retired

  • Members
  • PipPipPipPipPipPipPip
  • 7986 posts

Posted 21 February 2012 - 12:11 AM

Exactly!


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users