When i put something for username, username shows up FINE!!!! WORKS GREAT!!!, but when i do the same for Password field, (i removed ES_PASSWORD), it gives wierd string with weird alphabets, and says it doesnt have a string length.

Now how can TWO identical EDIT fields, with IDENTICAL processes (I looked all over my program with find, and couldnt find any conflicts of name or anything) have a result where one works and the other doesnt? :confused: :confused:

05-02-2006

anonytmouse

Code:

LPSTR Test;
LPSTR Passy;

These declare char pointers (char*). Writing to or reading from a pointer that has not been initialised is known as "a very bad thing".
Try:

oooooh maaan, i am sooooo dumb..... thank you so much... (cant believe i wasted 1 hour without figuring that out).

i was thinking LPSTR Test[60]; but i didnt think it make a difference.

But i was SURE it was LPSTR, because thats what header file says, and it worked for username, so i thought it was something else.

One question, could there be buffer overflows that may be possible here?
GetDlgItemText(hAppWnd, IDE_USERNAME, Test, 55);

if someone enters morethan 55 chars?

05-03-2006

anonytmouse

Quote:

One question, could there be buffer overflows that may be possible here?
GetDlgItemText(hAppWnd, IDE_USERNAME, Test, 55);

if someone enters morethan 55 chars?

The last argument of GetDlgItemText specifies the maximum number of characters, including the nul terminator, that can be returned. Therefore, if the user enters more than 54 characters the string will be truncated.

05-04-2006

execute

ok, but i defined it as
TCHAR Test[60];

so its only maximum at 60.
I can do a check for getdlgitemtext by getting length then adding 1.
but should i do same for defining the Test variable?