LanguageTable::LanguageTable() : m_lang(NULL), m_defaultLanguage(NULL), m_onlyDefaultLanguageSelectable(false) { SetDefaultLanguage( "english" ); }
int Locale::Load( MemBuffer &file ) { unsigned short langs = file.Read16(); for ( int i = 0; i < langs; ++i ) { Language lang; int rc = lang.ReadCatalog( file ); if ( rc >= 0 ) AddLanguage( lang ); else return -1; } if ( lib.size() == 0 ) return -1; if ( !SetDefaultLanguage( CF_LANG_DEFAULT ) ) { // no english translation found, use something we have SetDefaultLanguage( lib.begin()->first ); } return lib.size(); }
static BOOL HandleLogon( IN OUT PWLSESSION Session) { PROFILEINFOW ProfileInfo; BOOL ret = FALSE; /* Loading personal settings */ DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_LOADINGYOURPERSONALSETTINGS); ProfileInfo.hProfile = INVALID_HANDLE_VALUE; if (0 == (Session->Options & WLX_LOGON_OPT_NO_PROFILE)) { if (Session->Profile == NULL || (Session->Profile->dwType != WLX_PROFILE_TYPE_V1_0 && Session->Profile->dwType != WLX_PROFILE_TYPE_V2_0)) { ERR("WL: Wrong profile\n"); goto cleanup; } /* Load the user profile */ ZeroMemory(&ProfileInfo, sizeof(PROFILEINFOW)); ProfileInfo.dwSize = sizeof(PROFILEINFOW); ProfileInfo.dwFlags = 0; ProfileInfo.lpUserName = Session->MprNotifyInfo.pszUserName; ProfileInfo.lpProfilePath = Session->Profile->pszProfile; if (Session->Profile->dwType >= WLX_PROFILE_TYPE_V2_0) { ProfileInfo.lpDefaultPath = Session->Profile->pszNetworkDefaultUserProfile; ProfileInfo.lpServerName = Session->Profile->pszServerName; ProfileInfo.lpPolicyPath = Session->Profile->pszPolicy; } if (!LoadUserProfileW(Session->UserToken, &ProfileInfo)) { ERR("WL: LoadUserProfileW() failed\n"); goto cleanup; } } /* Create environment block for the user */ if (!CreateUserEnvironment(Session)) { WARN("WL: SetUserEnvironment() failed\n"); goto cleanup; } CallNotificationDlls(Session, LogonHandler); DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_APPLYINGYOURPERSONALSETTINGS); UpdatePerUserSystemParameters(0, TRUE); /* Set default user language */ if (!SetDefaultLanguage(Session)) { WARN("WL: SetDefaultLanguage() failed\n"); goto cleanup; } AllowWinstaAccess(Session); /* Connect remote resources */ RestoreAllConnections(Session); if (!StartUserShell(Session)) { //WCHAR StatusMsg[256]; WARN("WL: WlxActivateUserShell() failed\n"); //LoadStringW(hAppInstance, IDS_FAILEDACTIVATEUSERSHELL, StatusMsg, sizeof(StatusMsg) / sizeof(StatusMsg[0])); //MessageBoxW(0, StatusMsg, NULL, MB_ICONERROR); goto cleanup; } CallNotificationDlls(Session, StartShellHandler); if (!InitializeScreenSaver(Session)) WARN("WL: Failed to initialize screen saver\n"); Session->hProfileInfo = ProfileInfo.hProfile; /* Logon has succeeded. Play sound. */ PlayLogonSound(Session); ret = TRUE; cleanup: if (Session->Profile) { HeapFree(GetProcessHeap(), 0, Session->Profile->pszProfile); HeapFree(GetProcessHeap(), 0, Session->Profile); } Session->Profile = NULL; if (!ret && ProfileInfo.hProfile != INVALID_HANDLE_VALUE) { UnloadUserProfile(Session->UserToken, ProfileInfo.hProfile); } RemoveStatusMessage(Session); if (!ret) { SetWindowStationUser(Session->InteractiveWindowStation, &LuidNone, NULL, 0); CloseHandle(Session->UserToken); Session->UserToken = NULL; } if (ret) { SwitchDesktop(Session->ApplicationDesktop); Session->LogonState = STATE_LOGGED_ON; } return ret; }
BOOL InitializeSAS( IN OUT PWLSESSION Session) { WNDCLASSEXW swc; BOOL ret = FALSE; if (!SwitchDesktop(Session->WinlogonDesktop)) { ERR("WL: Failed to switch to winlogon desktop\n"); goto cleanup; } /* Register SAS window class */ swc.cbSize = sizeof(WNDCLASSEXW); swc.style = CS_SAVEBITS; swc.lpfnWndProc = SASWindowProc; swc.cbClsExtra = 0; swc.cbWndExtra = 0; swc.hInstance = hAppInstance; swc.hIcon = NULL; swc.hCursor = NULL; swc.hbrBackground = NULL; swc.lpszMenuName = NULL; swc.lpszClassName = WINLOGON_SAS_CLASS; swc.hIconSm = NULL; if (RegisterClassExW(&swc) == 0) { ERR("WL: Failed to register SAS window class\n"); goto cleanup; } /* Create invisible SAS window */ Session->SASWindow = CreateWindowExW( 0, WINLOGON_SAS_CLASS, WINLOGON_SAS_TITLE, WS_POPUP, 0, 0, 0, 0, 0, 0, hAppInstance, Session); if (!Session->SASWindow) { ERR("WL: Failed to create SAS window\n"); goto cleanup; } /* Register SAS window to receive SAS notifications */ if (!SetLogonNotifyWindow(Session->SASWindow)) { ERR("WL: Failed to register SAS window\n"); goto cleanup; } if (!SetDefaultLanguage(NULL)) return FALSE; ret = TRUE; cleanup: if (!ret) UninitializeSAS(Session); return ret; }