|
|
#1 |
|
Junior Member
Join Date: Mar 2010
Location: Zagreb
Posts: 5
|
I did read the documentation as suggested etc.. But, I still don't understand some fundamentals
This a code snippet taken from http://nsis.sourceforge.net/Docs/System/System.html#faq # allocate System::Alloc 32 Pop $1 # call System::Call "Kernel32::GlobalMemoryStatus(p r1)" # get System::Call "*$1(i.r2, i.r3, p.r4, p.r5, p.r6, p.r7, p.r8, p.r9)" # free System::Free $1 If I'm correct, $1 holds the pointer to 32 bytes. We want the GlobalMemoryStatus to fill that memory. Now, GlobalMemoryStatus takes r1 as an argument. How is $1 related to r1? $1 == r1???? Thank you. |
|
|
|
|
|
#2 |
|
Major Dude
Join Date: Oct 2006
Posts: 1,892
|
This is explained in the system plug-in readme.
|
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Mar 2010
Location: Zagreb
Posts: 5
|
MSG, unfortunately I still don't get it...
|
|
|
|
|
|
#4 | |
|
Major Dude
Join Date: Mar 2003
Posts: 571
|
Quote:
The documentation includes sample codecode: There is even a sample script in the Examples\System folder.code: |
|
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Mar 2010
Location: Zagreb
Posts: 5
|
Call me dumb, but I still don't see a connection between $1 and r1. If the answer is very long and complex, say so.
What makes sense is: System::Alloc 156 ; // sizeof(OSVERSIONINFOEX) Pop $0 System::Call "*$0(&i4 156)" System::Call "kernel32::GetVersionExA (p $0)" but it doesn't work... So, I guess I'm missing something big here. Perhaps switching to Visual Studio is much better idea... |
|
|
|
|
|
#6 | |
|
Major Dude
Join Date: Mar 2003
Posts: 571
|
Quote:
Here is the sample code from my last reply: Notice that the system plugin call uses .r0 and .r1 and .r2 and .r3 and that the DetailPrint commands refer to $0, $1, $2 and $3code: |
|
|
|
|
|
|
#7 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
If you specify $0 instead of .r0 then you're passing the string value of $0. Passing .r0 tells System to internally use the actual contents of $0.
Stu |
|
|
|
|
|
#8 |
|
Junior Member
Join Date: Mar 2010
Location: Zagreb
Posts: 5
|
pengyou and Afrow UK, thank you both very much!
I owe you a six pack :-) |
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Mar 2010
Location: Zagreb
Posts: 5
|
System::Alloc 284 ; // sizeof(OSVERSIONINFOEX)
Pop $0 ${If} $0 <> 0 System::Call "*$0(&i4 284)" System::Call "kernel32::GetVersionExW (p r0)" ${EndIf} System::Alloc 36 ; // sizeof(SYSTEM_INFO) Pop $1 ${If} $1 <> 0 System::Call "kernel32::GetNativeSystemInfo (p r1)" ${EndIf} System::Call "*$0(i, i.R2, i.R3)" System::Call "*$1(&i2.R4)" System::Free $1 System::Free $0 MessageBox MB_ICONINFORMATION|MB_OK "$R2,$R3,$R4" /SD IDOK R2, R3 and R4 are zero. Any suggestions/comments? |
|
|
|
|
|
#10 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Get rid of the spaces after your function names. And there is no 'p'.
GetVersionExW (p r0) -> GetVersionExW(ir0) You can look at WinVer.nsh for usage of GetVersionEx. Stu |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|