the last two parameters to the function are the buffer and the size of buffer.
the buffer gets the value -- what should be the type of buffer if the reg type is reg_dword? what should be the type of sizeofbuffer variable?
heres my code
Byte buffer
Dword sizeofbuffer = sizeof(buffer) and the last two parameters of the function regquesryvalueex are &buffer,&sizeofbuffer but the function doesnt return error_success nor ERROR_MORE_DATA nor ERROR_FILE_NOT_FOUND.
what is the problem????
edit: another question! the first parameter to the function is the handle returned from regopenkeyex when should i call regclosekey()?? should i call it after determine that regopenkeyex return error_success or after determined that both regopenkeyex and regqueryvaluex retun error_success????
lpType is the type of the actual registry value; REG_SZ, REG_DWORD etc.
lpData is the buffer where the data is returned, but you need the value in plType to interpret that data.
lpcbData is the size of the buffer, lpData.
i read the article and looked at it lots of times.
what is LPDWORD AND LPBYTE.
If u read closely u see i dont need iptype it can be null i dont want the get the reg type i already know its reg_dword.
answer my questions in my first post
thanks
LPDWORD is a pointer to (or the address of) a DWORD, LPBYTE is a pointer to (or the address of) an BYTE.
If u read closely u see i dont need iptype it can be null i dont want the get the reg type i already know its reg_dword.
You always need to know the type that's been read or else you can't interpret what's come back. In your example, you may set a REG_DWORD value in the registry, but what if someone else sets the value as a REG_SZ? The two representations of 10 have different binary layouts.
If the data has the REG_SZ, REG_MULTI_SZ or REG_EXPAND_SZ type, the string may not have been stored with the proper terminating null characters. Therefore, even if the function returns ERROR_SUCCESS, the application should ensure that the string is properly terminated before using it; otherwise, it may overwrite a buffer. (Note that REG_MULTI_SZ strings should have two terminating null characters.) One way an application can ensure that the string is properly terminated is to use RegGetValue, which adds terminating null characters if needed.