Archive: NSIS Unicode issues


NSIS Unicode issues
Hi,

I am writing a plugin to meet my customized requirements. This is how the plugin fn. structure look like.


extern "C" void __declspec(dllexport) AddMyUser(HWND hwndParent, int string_size,TCHAR *variables, stack_t **stacktop,extra_parameters *extra)
{
g_hwndParent=hwndParent;
EXDLL_INIT();
{
wchar_t password[512]=L"\0";
wchar_t username[2048]=L"\0";

if(popstring(username)==1||popstring(password)==1)
{
....
}
USER_INFO_1 ui;
ui.usri1_name =username;
....
....


The popped username and password does not seems to correctly popped as a unicode string. I have written this plugin to add a new user (I know plugins are already available in NSIS), when I give the command "net user" in command prompt it shows some junk characters. I am using visual studio 2010 and and the build setting is "use unicode character set". And I am calling the plugin fn. from NSIS script as follows

MyNSISPlugin::AddMyUser "StdUser" $Password 


while compiling I am getting the following warning also
>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\tchar.h(268): warning C4005: '_vstprintf' : macro redefinition
1> h:\myplugin\nsis\nsis_tchar.h(41) : see previous definition of '_vstprintf'


Where could be the mistake?

Thanks for your help,
Lloyd

Have you linked against the correct plug-in library? Just changing the character set alone is not enough.

Stu