Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 20th November 2009, 17:50   #1
joelpaula
Junior Member
 
joelpaula's Avatar
 
Join Date: Oct 2003
Location: Lisboa, Portugal
Posts: 5
Unhappy Strange error with EnumRegValue in Windows Server 2003 R2

I am using the following code (I took from somewhere/someone in the NSIS site) to get the ms.net framework v2 folder:
code:
Exch $R0 ; Set R0 has "v2.0" in it
Push $R1
Push $R2

;This next line prints OK
DetailPrint "Searching for Microsoft.net $R0"

; set R1 to minor version number of the installed .NET runtime
EnumRegValue $R1 HKLM \
"Software\Microsoft\.NetFramework\policy\$R0" 0
IfErrors getdotnetdir_err

DetailPrint "Searching for Microsoft.net $R0 build $R1"

; set R2 to .NET install dir root
ReadRegStr $R2 HKLM \
"Software\Microsoft\.NetFramework" "InstallRoot"
IfErrors getdotnetdir_err

DetailPrint "Root folder found: $R2"
DetailPrint "Found folder: $R2$R0.$R1"

; set R0 to the .NET install dir full
StrCpy $R0 "$R2$R0.$R1"

getdotnetdir_end:
Pop $R2
Pop $R1
Exch $R0 ; return .net install dir full
Return

getdotnetdir_err:
DetailPrint "Where were we? $R2$R0.$R1"
StrCpy $R0 ""
Goto getdotnetdir_end



The result in Windows Server 2003 R2 is always
"Searching for Microsoft.net v2.0
Where were we? 1v2.0.50727"

So it seems like EnumRegValue returns an error in spite of also returnin the correct key name ("50727").

I changed it to this, in order to get it working:
code:

; set R1 to minor version number of the installed .NET runtime
EnumRegValue $R1 HKLM \
"Software\Microsoft\.NetFramework\policy\$R0" 0
StrCmp $R1 "" getdotnetdir_err

DetailPrint "Searching for Microsoft.net $R0 build $R1"
ClearErrors



DO you have any idea why this behaviour?

Thanks for your help.
Joel
joelpaula is offline   Reply With Quote
Old 20th November 2009, 20:14   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,814
Could you run process monitor from MS/sysinternals and see if anything pops out at you?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump