GetUserDefaultLocaleName() API is crashing
- by Santhosha
I have one application which reads user default locale in Windows Vista and above. When i tried calling the API for getting User default Locale API is crashing. Below is the code, It will be helpfull if any points the reason 
#include <iostream>
#include <WinNls.h> 
#include <Windows.h>
int main()
{
    LPWSTR lpLocaleName=NULL;
    cout << "Calling GetUserDefaultLocaleName";
    int ret = GetUserDefaultLocaleName(lpLocaleName, LOCALE_NAME_MAX_LENGTH);
    cout << lpLocaleName<<endl;
}