Storing variables in a program
-
I have a dialog box application that I would like to remember some strings that i type in for the next time the program starts... I don't want to just write them to a text file for obvious security problems, i was thinking more like writing them to a string table, but i don't know if i can do that while the program is running rather than while programming it... Any suggestions will be greatly appreciated and i can give more information if need be. thx ix
-
I have a dialog box application that I would like to remember some strings that i type in for the next time the program starts... I don't want to just write them to a text file for obvious security problems, i was thinking more like writing them to a string table, but i don't know if i can do that while the program is running rather than while programming it... Any suggestions will be greatly appreciated and i can give more information if need be. thx ix
First, depending on who you are securing the data from, string tables are no more secure than a text file. Second, security is a large complex issue, you should read much about it before you begin to assume what is secure. Third, you cannot write the resources of a file that is currently loaded.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
-
I have a dialog box application that I would like to remember some strings that i type in for the next time the program starts... I don't want to just write them to a text file for obvious security problems, i was thinking more like writing them to a string table, but i don't know if i can do that while the program is running rather than while programming it... Any suggestions will be greatly appreciated and i can give more information if need be. thx ix
-
I have a dialog box application that I would like to remember some strings that i type in for the next time the program starts... I don't want to just write them to a text file for obvious security problems, i was thinking more like writing them to a string table, but i don't know if i can do that while the program is running rather than while programming it... Any suggestions will be greatly appreciated and i can give more information if need be. thx ix
I guess i should clarify, security isn't that important, really i just don't want to have a text file with the strings in it... Its for an ftp program, where you can write in lots of different usernames and passwords so it remembers them all for next time... the registry is where i do that? thanx for the replys.
-
I guess i should clarify, security isn't that important, really i just don't want to have a text file with the strings in it... Its for an ftp program, where you can write in lots of different usernames and passwords so it remembers them all for next time... the registry is where i do that? thanx for the replys.
-
Yep, just about every application that remembers the application options and various settings stores that information in the registry.
-
I guess i should clarify, security isn't that important, really i just don't want to have a text file with the strings in it... Its for an ftp program, where you can write in lots of different usernames and passwords so it remembers them all for next time... the registry is where i do that? thanx for the replys.
>> where you can write in lots of different >> usernames and passwords >> the registry is where i do that? If this is going to be a production product then I would seriously advise against that. Storing passwords a clear text anywhere is not going to be considered acceptable. As I stated previously, security is a large subject, you can't really know until you start to investigate it. There are so many resources available these days on the net for reading about software security issues. You really should take some time to understand the subject more thoroughly. But, that's just my opinion… I could be wrong.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
-
I have a dialog box application that I would like to remember some strings that i type in for the next time the program starts... I don't want to just write them to a text file for obvious security problems, i was thinking more like writing them to a string table, but i don't know if i can do that while the program is running rather than while programming it... Any suggestions will be greatly appreciated and i can give more information if need be. thx ix
-
Does anyone know a good site for learning how to edit the registry from inside a program? thx
The CRegKey class is what you want to use: // Read a DWORD from the registry DWORD dwValue = 0; CString csKEY = "Software\\Company"; CRegKey key; if ( key.Open(HKEY_LOCAL_MACHINE, csKEY, KEY_READ) == ERROR_SUCCESS) { if (key.QueryDWORDValue("MyKey", dwValue) == ERROR_SUCCESS) AfxMessageBox("You read it into dwValue"); key.Close(); } // Write a DWORD to the registry DWORD dwValue = 3; CString csKEY = "Software\\Company"; CRegKey key; if ( key.Create(HKEY_LOCAL_MACHINE, csKEY) == ERROR_SUCCESS) { if (key.SetDWORDValue("MyKey", dwValue) == ERROR_SUCCESS) AfxMessageBox("You wrote it"); key.Close(); }
-
The CRegKey class is what you want to use: // Read a DWORD from the registry DWORD dwValue = 0; CString csKEY = "Software\\Company"; CRegKey key; if ( key.Open(HKEY_LOCAL_MACHINE, csKEY, KEY_READ) == ERROR_SUCCESS) { if (key.QueryDWORDValue("MyKey", dwValue) == ERROR_SUCCESS) AfxMessageBox("You read it into dwValue"); key.Close(); } // Write a DWORD to the registry DWORD dwValue = 3; CString csKEY = "Software\\Company"; CRegKey key; if ( key.Create(HKEY_LOCAL_MACHINE, csKEY) == ERROR_SUCCESS) { if (key.SetDWORDValue("MyKey", dwValue) == ERROR_SUCCESS) AfxMessageBox("You wrote it"); key.Close(); }
-
>> where you can write in lots of different >> usernames and passwords >> the registry is where i do that? If this is going to be a production product then I would seriously advise against that. Storing passwords a clear text anywhere is not going to be considered acceptable. As I stated previously, security is a large subject, you can't really know until you start to investigate it. There are so many resources available these days on the net for reading about software security issues. You really should take some time to understand the subject more thoroughly. But, that's just my opinion… I could be wrong.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
I agree this is definitly an area where security is a must and the data must be encrypted. Storing unencrypted values in the registry is not much better than storing them in a file named passwords... John