![]() |
Terminating string
Hello,
I need to read a string with fix size and compare it: code: I have no idea how to terminate my $R4. In C I just would do something like $R4[8]='\0'; But, with NSIS? Does anybody know? Claus |
err, if $R4 is a normal nsis string you can just do StrCpy $R4 $R4 9 or whatever
|
Sorry, there's a little bug in my code. i forgot to pop $R4 after allocation:
code: So $R4 isn't a normal NSIS string. Claus |
Mmmh, no answers?
No, my question isn't answered so far. As you can see, I allocate 9 bytes in $R4 and read the first 8 bytes via MyDLL::ReadMem. To compare with "SameText" the string in $R4 must be null terminated. How can I do this? |
you can use the struct handling in system.dll, something like: system::call '*$R4(&t8,&i1 0)' (untested code off the top of my head)
but that is rather pointless since you need to get it out of the memory pointer and into a nsis var before you can StrCmp it, so get the string with something like system::call '*$R4(&t8 .r0)' and StrCmp $myfoo $r0 |
Quote:
Okay, I have replaced code: with code: Quote:
Claus |
i did not mean replace, it was just for adding the 0 terminator, but yeah, you can alloc the struct like that, but it would be: System::Call "*(&t8,i 0).R4"
|
Thank you, Anders, for your help. I'm doing now:
code: Claus |
I don't understand why you want to zero terminate this string when you can just extract it from the struct like i posted in my 2nd example, just stick .r0 after &t${SameTextSize} and use $0 in the strcmp
|
Do you mean the following?
code: Yes, I can do it, if this works. But I wasn't really sure that $0 is null terminated this way. Claus |
| All times are GMT. The time now is 04:34. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.