View Single Post
Old 10th August 2015, 03:13   #2
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 881
Nice work.

One observation, when you are allocating memory for the buffer, the sizing appears to be wrong. string_size is the number of characters, for ansi this is fine as they are one byte each. Under unicode the size is two bytes, so the actual length allocated is half. So the 'correct' way is sizeof(TCHAR)*string_size.

I also see a mixing of unicode only functions and TCHAR strings, this would break the ansi build. Is this intentional or a mistake?

Also, to help remove connections to the CRT, change ZeroMemory() to SecureZeroMemory(). Oh, and swap _tsclen() for lstrlen(), and _sntprintf() for wnsprintf(), and _ttoi() for myatoi() (provided by the plugin api). Use Dependency Walker to confirm that MSVCRTx0.DLL isn't in the list.

Just as a side note, the callback functions return type is usually an LRESULT, but since INT_PTR is the same width I guess it doesn't make any difference.

Sorry for nitpicking, I just ported Afrow UK's PassDialog plugin from char only to unicode and 64 bit, and I still have a bit of a buzz from it.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote