flat assembler
Message board for the users of flat assembler.
Index
> Windows > Registry (RegOpenKeyEx,RegQueryValueEx) |
Author |
|
handyman 16 Jun 2007, 13:27
jumpex wrote:
Quote:
I think you should be sure you are using address pointers where address pointers are supposed to be used. i.e.: the last two parameters (5 & 6) need to be address pointers to the data buffer and buffer size variables instead of being the actual data values. 'path' contains a pointer, but '50' does not. The last parameter is also used by the function to send data back. |
|||
16 Jun 2007, 13:27 |
|
jumpex 16 Jun 2007, 14:33
Thank you for your quick responce. Really - thanks.
Nevertheless, I changed what you said to this: (temp dd ?) mov [temp],50 invoke RegOpenKeyEx,HKEY_LOCAL_MACHINE,key,0,KEY_READ,skyhand invoke RegQueryValueEx,[skyhand],value,0,0,[path],[temp] The variable 'path' is still empty after the operation. Is anything else out of order? |
|||
16 Jun 2007, 14:33 |
|
jumpex 16 Jun 2007, 19:15
Problem solved. I had to remove the DOUBLE '\' lines and put single ones (unlike so many other HL programming langugages).
|
|||
16 Jun 2007, 19:15 |
|
LocoDelAssembly 16 Jun 2007, 19:30
fasm doesn't perform any interpretation on strings, it just wait for ' or " (depending of which one you used to start the string), to close the string.
|
|||
16 Jun 2007, 19:30 |
|
handyman 17 Jun 2007, 12:55
Just an addition thought since pointers are involved here,
you should probably use invoke RegQueryValueEx,[skyhand],value,0,0,[path],temp because I assume that you are filling [path] with a an address value that points to the path string whereas [temp] is just filled with a value, not a pointer. You have to be sure that any function requiring a pointer parameters do not point somewhere you do not want it to, especially if the function wants to change that memory area. in your example '[temp]' will still point it to memory location 50 whereas 'temp' will point to wherever 'temp' is located and that will receive one of pieces of return data that the 'RegQueryValueEx' function returns. Even though the function seems to work now, what is the value in '[temp]' on return? The function definition says that it returns the 'path' length here. if the 'path' string length ends up in 'temp' then the call is working OK. On the otherhand, if the value in 'temp' is still 50 when the string length in 'path' is not 50 then the function call may have altered some memory somewhere that probably should not be altered, location 50 in this case. Be sure to make sure that returned 'path' string length is not the same as what you set 'temp' to when you call the function otherwise you won't learn anything on testing the function call. You should be able to see that the value in temp is different after the call. |
|||
17 Jun 2007, 12:55 |
|
jumpex 17 Jun 2007, 16:49
Hey, thanks. I've learned a lot from this call alone. And I'll test that when I get home. I've had to 0 temp after the call, otherwise 'path' had an apostrophe in the end. I'm not sure why. Maybe it was because of what you are saying. Thank you for the responce.
|
|||
17 Jun 2007, 16:49 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.