|
If int i; is the decleration then what could be the definition?
Can any one please let me know this.
Nice talking to you.
|
|
|
|
|
i = 3; ???
That's used for methods...
|
|
|
|
|
int
int is a built-in atomic type that the compiler recognizes as part of the particular language definition you're using, in this case C++. So read the docs to find what an int or some other type is defined as. As for C++ on Win32 int is defined as a storage size of 4 bytes which can contain values ranging in -(2^32-1) and +2^32.
Other compilers/platforms may define it slightly differently resulting in a differing value range.
|
|
|
|
|
|
I have a simple C++6.0/MFC SDI application that has some username/passwords associated with it. Up to now I have stored these items in the registry since there was no real security needs. However, there are now a few users who are requesting some increased security so I would like to encrypt/decrypt the username and passwords. I have searched for and found many encryption downloads but was wondering if there is any consensus on a preferred one. I just need to encrypt/decrypt a string as simply as possible, with moderate security. Thanks for your time and any assistance. StoneRaven
|
|
|
|
|
You could use a simple xor on the password.
I think the standard way is to use a MD5 hash or SHA hash.
You hash the user password and store the hash in the registry. After you get the plain text password from the user you then hash the password and then compare the hash value to the hash value stored in the registry. This way even if the registry is compromised the password is not stored in the clear.
Forever Developing
|
|
|
|
|
I don't know what is you application for, but if you need increased security you need to change the way you store user/password.
You could encrypt the passwords with any algoritm you want, but if someone modifies the registry and sets the password to null, all you security is f****d up.
If you still want to store the info in the registry, and want the users to think that they have improved security, just add 100 or some random number to the string, and is the same.
|
|
|
|
|
StoneRaven wrote: so I would like to encrypt/decrypt the username and passwords
RC4[^] is well suited for you need
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
If you want to use Win encryption as simply as possible then use CryptProtectData()/CryptUnprotectData() to encrypt/decrypt the secret data before/after writing/reading the registry.
These will allow you to use either the machine key (any user on machine can decrypt the data), or the current user key (only that user can decrypt the data).
...cmk
Save the whales - collect the whole set
|
|
|
|
|
How do I go about getting a storable value from the encrypted DATA_BLOB that can be stored/recovered from the registry and re-inserted in a new DATA_BLOB struct for decryption later on? Thanks...
|
|
|
|
|
if you are putting the app into the public domain, then I suggest that you use at least des56. The hackers out there WILL try to break your encryption and if you use xor or bit flipping, they will break it and post the findings on a hundred hacker bulletin boards. MS has some simple envelope and password encrypt functions in their csp that make it easy or there are many examples out there. I bury a long password in code somewhere and use it as the password to encrypt/decrypt the envelope. Be sure to obfuscate your code or that part where the password is hidden to thwart decompliers.
http://msdn.microsoft.com/msdnmag/issues/03/11/NETCodeObfuscation
|
|
|
|
|
Hi there,
I need to get the dimensions of a window's restored/normal size when it is maximized. This might sound simple, but i have spent hours trying different SDK and CWnd functions, and searching this forum and others, but to no avail.
The only function i can find that apparently retrieves the restored window size is GetWindowPlacement() and use its "rcNormalPosition" member. However, this member does not contain the correct restored size. When i compare the value of this member to the actual size that the window was before being maximized, it is different (the size is a lot bigger, and the top-left is a -3 value for some reason).
When i click the MDI window's restore button it restores the window to its previous (restored) correct size. Therefore the SDK obviously stores this value correctly somewhere in order to correctly restore it. Why can i not get this correct value from the SDK or CWnd please?
It seems a simple thing yet i have spent quite some time and have not found the answer.
Any help for this would be very much appreciated. Thank you.
Regards,
James
|
|
|
|
|
I think the values in the WINDOWPLACEMENT structure are opaque, in that they don't relate to "real" coordinates. We have the same requirement for one of our apps, and what we do is call GetWindowPlacement when closing the app, save all the values in the structure, and on startup, recreate the WINDOWPLACEMENT structure, and call SetWindowPlacement .
|
|
|
|
|
Hi Graham,
Thanks a lot for replying. I think that you are correct about the values of the WINDOWPLACEMENT structure not being "real".
My trouble is that the way in which we store window information, i cant currently store the WINDOWPLACEMENT structure and then restore it using that. We only store the starting point (x,y) and dimensions (cx,cy), and also whether it is maximised or not. Unfortunately i am limited to this and so i really need the actual restored point and dimensions.
Im sure that there must be a way to get this information, as the window is correctly restored by the SDK and so it must be able to work out the window's original placement info (even if it uses the WINDOWPLACEMENT structure to determine the "real" dimensions).
Thanks again for your suggestion, much appreciated.
Any further suggestions or help on the problem would be greatly appreciated.
Thanks,
James
|
|
|
|
|
OK then, my other suggestion would be to handle the WM_SIZE message in the top-level window, and keep track of size information there. One of the parameters of the WM_SIZE message says what kind of sizing has happened, so you could store both the state and normal size in response to this message, and then use those values instead.
|
|
|
|
|
Hi Graham,
Thank you for your second suggestion.
I have just figured out my problem. I was calling GetWindowPlacement() for the each bar/window in the mainframe to get their placement information, but it was always returning the maximised dimensions. I then attempted to call GetWindowPlacement() for the window's parent FRAME instead, which actually gave me the correct dimensions. I didnt realise that this would make a difference but obviously it seems to. It makes sense i guess.
Anyway, thanks very much for your assistance! Much appreciated.
Regards,
James
|
|
|
|
|
Hi
Is any way I could get notified when a HID device is conected/disconnected to the USB port? So I shouldn't be checking each 3 seconds if my device is connected?
Thanks
|
|
|
|
|
|
Hi,
I am placing a bitmap on a button using LoadBitMap and SetBitMap.
The problem is that when I draw the bitmap, I want the background to be transparent so it will appear nice on the button.
From some reason, the "Draw Opaque" is checked by default in VisualStudio on the "Image" menu and I can't change it.
How do I use a transparent background on a bit map I am drawing.
Shay
|
|
|
|
|
Hi,
my name is marco and i am working for Project Zero.
Project zero has taken over the Development of Soldner Secretwars.
I can`t tell much here, but from jan. we get a budget for it.
Jowood finally came true.
I am the lead coder, wich is great.
The bad side is that i have to code the new mod in c/c++ by myself.
Is there a tool that MAPS globals in a DEEP NESTED class archy?
example:
struct SOLDIER{} * t_SOLDIER;
class a,public b,public c
{
a() :c:var_a(0) {this=t_SOLDIER;}
};
Not exactly correct but who cares, i see this mess every day.
What i want is a tool to map all vars,globals,classes,structs.
Becouse i need to create a overview of +-2500 code files.
If you wanna help...... send me a email.
You will run away after a week
And u need math!
direct-x math!
i need 2 bring orde into this chaos.
Any sugestions about tools are verryverryverryverryverryverryverry apreciated.
Bye and thanx.!
Marco project zero lead c/c++ coder. check out www.secretwars.net
|
|
|
|
|
|
Hi,
you could try this, there is a trial version availabele.
http://www.scitools.com/ucpp.html[^]
Good luck
BTW: yikes, I always thought game writing was just pure fun
codito ergo sum
|
|
|
|
|
oversight-[project-zero] wrote: Any sugestions about tools are verryverryverryverryverryverryverry apreciated.
what about http://www.rationalrose.com/[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Did you try Visual C++ ??
oversight-[project-zero] wrote: If you wanna help...... send me a email.
definitely not
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
yes,
i use visual c/c++.net2005 (coded a build booster to speed it up).
The whole project is build with make_master.bat wich calls various makefiles.
I can also load it in dev studio and build but this is slow...
it takes 20 minits on my amd64 1gb ram to build soldner.
the c/c++ code calls python,xml (mixed.....)
Its real spagetti code....
And we have lots of fun!
i wish i had some more c/c++ college`s
anyone voluteering?
|
|
|
|