Fixed memory allocation in LPWSTR and LPSTR classes

Fixed: Memory is correctly allocated when constructing LPWSTR or LPSTR from Java String. Unallocated memory caused NullPointerException. Tests for this fix added.