Problem in adding registry entry values
-
Hi all, I am trying to a add a Regitry Entry using MFC api's. Suppose i want to give my program file address to the registry value..... Its not taking full address its just taking 25 characters for example:- C:\Program Files\Data Can anybosy please help me in this.....
-
Hi all, I am trying to a add a Regitry Entry using MFC api's. Suppose i want to give my program file address to the registry value..... Its not taking full address its just taking 25 characters for example:- C:\Program Files\Data Can anybosy please help me in this.....
neha.agarwal27 wrote:
I am trying to a add a Regitry Entry using MFC api's.
Can you please show us the relevant code? Because 1. We can't answer solely on assumptions 2. And there's a pillar right next to your cubicle, so I am not able to see your monitor.
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
Hi all, I am trying to a add a Regitry Entry using MFC api's. Suppose i want to give my program file address to the registry value..... Its not taking full address its just taking 25 characters for example:- C:\Program Files\Data Can anybosy please help me in this.....
i think u r buffer size may be 25 characters or u r writing only 25 characters
-
Hi all, I am trying to a add a Regitry Entry using MFC api's. Suppose i want to give my program file address to the registry value..... Its not taking full address its just taking 25 characters for example:- C:\Program Files\Data Can anybosy please help me in this.....
neha.agarwal27 wrote:
I am trying to a add a Regitry Entry using MFC api's.
MFC has an API for the registry? :confused:.
neha.agarwal27 wrote:
Suppose i want to give my program file address to the registry value..... Its not taking full address its just taking 25 characters for example:- C:\Program Files\Data
Be aware that
RegSetValueEx
'scbData
parameter should be the size of the string expressed in bytes, i.e.(string length + 1)*2
forUNICODE
strings. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
neha.agarwal27 wrote:
I am trying to a add a Regitry Entry using MFC api's.
MFC has an API for the registry? :confused:.
neha.agarwal27 wrote:
Suppose i want to give my program file address to the registry value..... Its not taking full address its just taking 25 characters for example:- C:\Program Files\Data
Be aware that
RegSetValueEx
'scbData
parameter should be the size of the string expressed in bytes, i.e.(string length + 1)*2
forUNICODE
strings. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain ClarkeThanks for your reply..... it worked fine with my code.... now my problem is my code is creating registry enteries fine in xp but its not creating it in vista but when i run my program as administrator it creates the enteries.... how can i remove my problem...
-
Thanks for your reply..... it worked fine with my code.... now my problem is my code is creating registry enteries fine in xp but its not creating it in vista but when i run my program as administrator it creates the enteries.... how can i remove my problem...
Hence run the program as administrator. :-D Seriously, I don't know. Maybe you'll have more luck on Vista[^] forum. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
Hence run the program as administrator. :-D Seriously, I don't know. Maybe you'll have more luck on Vista[^] forum. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarkeand when i am trying to add binary entry(REG_BINARY), like if i want to add 11 01 10 11 then in registry only 00 00 00 00 is added.... can you tell me the problem
-
and when i am trying to add binary entry(REG_BINARY), like if i want to add 11 01 10 11 then in registry only 00 00 00 00 is added.... can you tell me the problem
Could you please post the relevant code?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
Could you please post the relevant code?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain ClarkeRegCreateKeyEx ( hkey, (LPCTSTR) str1, 0, NULL, REG_OPTION_NON_VOLATILE,
KEY_CREATE_SUB_KEY | KEY_ALL_ACCESS, NULL, &childkey, &dispos ) ;RegSetValueEx ( childkey, (LPCTSTR)str2, 0, valur_type, (const BYTE*) (LPCTSTR)str4, (str4.GetLength()+1)*2 ) ;
RegCloseKey ( childkey ) ; -
RegCreateKeyEx ( hkey, (LPCTSTR) str1, 0, NULL, REG_OPTION_NON_VOLATILE,
KEY_CREATE_SUB_KEY | KEY_ALL_ACCESS, NULL, &childkey, &dispos ) ;RegSetValueEx ( childkey, (LPCTSTR)str2, 0, valur_type, (const BYTE*) (LPCTSTR)str4, (str4.GetLength()+1)*2 ) ;
RegCloseKey ( childkey ) ;I don't see any
REG_BINARY
in your code. BTW To maintain generic text mappings, I suggest you to change from(str4.GetLength()+1)*2
to(str4.GetLength()+1) * sizeof(TCHAR)
. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
Hi all, I am trying to a add a Regitry Entry using MFC api's. Suppose i want to give my program file address to the registry value..... Its not taking full address its just taking 25 characters for example:- C:\Program Files\Data Can anybosy please help me in this.....