static void ErrorDump() { #if 0 USES_CONVERSION; CDBErrorInfo einfo; BSTR bstrDescription; ULONG nRecords = 0; HRESULT hr = einfo.GetErrorRecords(&nRecords); if(SUCCEEDED(hr) && nRecords > 0) { LCID lcid = GetSystemDefaultLCID(); for(ULONG nIndex = 0; nIndex < nRecords; nIndex++) { hr = einfo.GetAllErrorInfo(nIndex, lcid, &bstrDescription); if(SUCCEEDED(hr)) { AfxMessageBox(OLE2T(bstrDescription)); SysFreeString(bstrDescription); } } } #endif USES_CONVERSION; CComPtr<IErrorInfo> pErrInfo; HRESULT hr = ::GetErrorInfo(0, &pErrInfo); if(SUCCEEDED(hr)) { _bstr_t bstrErrDescription; pErrInfo->GetDescription((BSTR *) &bstrErrDescription); CString strDescription = W2T(bstrErrDescription); OutputDebugString(strDescription); } }
void __fastcall TAcquireThread::Draw() { switch(mm) { case 0: // StatusRecForm->Label1->Caption = s; // StatusRecForm->Label2->Caption = s1; break; case 1: StatusRecForm->Close(); MainForm->StartMonitoring(); break; case 2: // StatusRecForm->Label2->Caption = "Количество блоков " + IntToStr // (num_blocks); break; case 3: // StatusRecForm->ProgressBar1->Position = pos; break; case 4: TFormatSettings FormatSettings; GetLocaleFormatSettings(GetSystemDefaultLCID(), FormatSettings); FormatSettings.ThousandSeparator = 160; FormatSettings.CurrencyString = ""; FormatSettings.CurrencyDecimals = 0; MainForm->ListView2->Items->Item[0]->SubItems[0].Text = FloatToStr(t) + " нс"; MainForm->ListView2->Items->Item[1]->SubItems[0].Text = FloatToStrF (AcfParams._time * 1e-6, ffFixed, 5, 2) + " с"; MainForm->ListView2->Items->Item[2]->SubItems[0].Text = Format ("%m", ARRAYOFCONST((double(AcfParams.vybr))), FormatSettings); MainForm->ListView2->Items->Item[3]->SubItems[0].Text = FloatToStr (AcfParams.zashk / n0 * 100) + "%"; MainForm->ListView2->Items->Item[4]->SubItems[0].Text = Format ("%m", ARRAYOFCONST((1e6 * n1 / AcfParams._time)), FormatSettings); MainForm->ListView2->Items->Item[5]->SubItems[0].Text = Format ("%m", ARRAYOFCONST((double(n1))), FormatSettings); int ind = 0; for (int i = 0; i < n1; i++) { if (RawData_t.a[i] > 1e6) { ind = i - 1; break; } } int m = Floor(ind / 1e3); MainForm->Series1->Clear(); for (int i = 0; i < 1e3; i++) { if (!(RawData.a[i * m] == 0)) { MainForm->Series1->AddXY(RawData_t.a[i * m] * 1e-6, 1e9 / (RawData.a[i * m] * t)); } else { MainForm->Series1->AddNullXY(RawData_t.a[i * m] * 1e-6, 0); } } break; } }
BOOL ShowPopupMenu() { POINT pt; HMENU hSubMenu = NULL; BOOL isZHCN = GetSystemDefaultLCID() == 2052; if (lpSubMenuTitleList[1] != NULL) { hSubMenu = CreatePopupMenu(); for (int i = 0; lpSubMenuTitleList[i]; i++) { UINT uFlags = wcscmp(lpSubMenuTitleList[i], szSubTitleLast) == 0 ? MF_STRING | MF_CHECKED : MF_STRING; LPCTSTR lpText = wcslen(lpSubMenuTitleList[i]) ? lpSubMenuTitleList[i] : ( isZHCN ? L"默认" : L"<None>"); AppendMenu(hSubMenu, uFlags, WM_TASKBARNOTIFY_MENUITEM_SUBMENULIST_BASE+i, lpText); } } HMENU hMenu = CreatePopupMenu(); AppendMenu(hMenu, MF_STRING, WM_TASKBARNOTIFY_MENUITEM_SHOW, ( isZHCN ? L"显示" : L"Show") ); AppendMenu(hMenu, MF_STRING, WM_TASKBARNOTIFY_MENUITEM_HIDE, ( isZHCN ? L"隐藏" : L"Hide") ); if (hSubMenu != NULL) { AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT_PTR)hSubMenu, ( isZHCN ? L"常用命令" : L"SubMenu") ); } AppendMenu(hMenu, MF_STRING, WM_TASKBARNOTIFY_MENUITEM_RELOAD, ( isZHCN ? L"重新运行" : L"Reload") ); AppendMenu(hMenu, MF_STRING, WM_TASKBARNOTIFY_MENUITEM_EXIT, ( isZHCN ? L"退出" : L"Exit") ); GetCursorPos(&pt); TrackPopupMenu(hMenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hWnd, NULL); PostMessage(hWnd, WM_NULL, 0, 0); if (hSubMenu != NULL) { DestroyMenu(hSubMenu); } DestroyMenu(hMenu); return TRUE; }
BOOL ShowPopupMenu() { POINT pt; HMENU hSubMenu = NULL; BOOL isZHCN = GetSystemDefaultLCID() == 2052; LPCTSTR lpCurrentProxy = GetWindowsProxy(); if (lpProxyList[1] != NULL) { hSubMenu = CreatePopupMenu(); for (int i = 0; lpProxyList[i]; i++) { UINT uFlags = wcscmp(lpProxyList[i], lpCurrentProxy) == 0 ? MF_STRING | MF_CHECKED : MF_STRING; LPCTSTR lpText = wcslen(lpProxyList[i]) ? lpProxyList[i] : ( isZHCN ? L"\x7981\x7528\x4ee3\x7406" : L"<None>"); AppendMenu(hSubMenu, uFlags, WM_TASKBARNOTIFY_MENUITEM_PROXYLIST_BASE+i, lpText); } } HMENU hMenu = CreatePopupMenu(); AppendMenu(hMenu, MF_STRING, WM_TASKBARNOTIFY_MENUITEM_SHOW, ( isZHCN ? L"\x663e\x793a" : L"Show") ); AppendMenu(hMenu, MF_STRING, WM_TASKBARNOTIFY_MENUITEM_HIDE, ( isZHCN ? L"\x9690\x85cf" : L"Hide") ); if (hSubMenu != NULL) { AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT_PTR)hSubMenu, ( isZHCN ? L"\x8bbe\x7f6e IE \x4ee3\x7406" : L"Set IE Proxy") ); } AppendMenu(hMenu, MF_STRING, WM_TASKBARNOTIFY_MENUITEM_RELOAD, ( isZHCN ? L"\x91cd\x65b0\x8f7d\x5165" : L"Reload") ); AppendMenu(hMenu, MF_STRING, WM_TASKBARNOTIFY_MENUITEM_EXIT, ( isZHCN ? L"\x9000\x51fa" : L"Exit") ); GetCursorPos(&pt); TrackPopupMenu(hMenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hWnd, NULL); PostMessage(hWnd, WM_NULL, 0, 0); if (hSubMenu != NULL) DestroyMenu(hSubMenu); DestroyMenu(hMenu); return TRUE; }
void win32_test_special_locales(void) { nsresult result; nsCOMPtr<nsIWin32Locale> win32Locale; nsCOMPtr<nsILocaleFactory> xp_locale_factory; nsCOMPtr<nsILocale> xp_locale; nsString* locale, *result_locale, *category; LCID sys_lcid, user_lcid; PRUnichar *lc_name_unichar; win32Locale = do_CreateInstance(kWin32LocaleFactoryCID, &result); NS_ASSERTION(NS_SUCCEEDED(result),"nsLocaleTest: factory_create_interface failed"); xp_locale_factory = do_GetClassObject(kLocaleFactoryCID, &result); NS_ASSERTION(NS_SUCCEEDED(result),"nsLocaleTest: factory_create_interface failed"); category = new nsString(localeCategoryList[0]); // // derive a system locale // result = xp_locale_factory->GetSystemLocale(getter_AddRefs(xp_locale)); NS_ASSERTION(NS_SUCCEEDED(result),"nsLocaleTest: factory_create_interface failed"); sys_lcid = GetSystemDefaultLCID(); locale = new nsString(); result_locale = new nsString(); result = win32Locale->GetXPLocale(sys_lcid,locale); NS_ASSERTION(NS_SUCCEEDED(result),"nsLocaleTest: factory_create_interface failed"); result = xp_locale->GetCategory(category, &lc_name_unichar); NS_ASSERTION(NS_SUCCEEDED(result),"nsLocaleTest: factory_create_interface failed"); result_locale->SetString(lc_name_unichar); delete result_locale; // // derive a system locale // result = xp_locale_factory->GetApplicationLocale(getter_AddRefs(xp_locale)); NS_ASSERTION(NS_SUCCEEDED(result),"nsLocaleTest: factory_create_interface failed"); user_lcid = GetUserDefaultLCID(); locale = new nsString(); result_locale = new nsString(); result = win32Locale->GetXPLocale(user_lcid,locale); NS_ASSERTION(NS_SUCCEEDED(result),"nsLocaleTest: factory_create_interface failed"); result = xp_locale->GetCategory(category, &lc_name_unichar); NS_ASSERTION(NS_SUCCEEDED(result),"nsLocaleTest: factory_create_interface failed"); result_locale->SetString(lc_name_unichar); delete result_locale; delete category; }
STDAPI DllUnregisterServer(void) { WCHAR clsidStr[200]; StringFromGUID2(CLSID_Book, clsidStr, 200); WCHAR keyname[200]; StringCchPrintf(keyname, 200, L"CLSID\\%s", clsidStr); SHDeleteKey(HKEY_CLASSES_ROOT, keyname); UnRegisterTypeLib(LIBID_BookLibrary, 1, 0, GetSystemDefaultLCID(), SYS_WIN32); return S_OK; }
bool CheckThreadLocale() { if (theApp.GetProfileInt(_T("eMule"), _T("SetLanguageACP"), 0) != 0) return true; int iSetSysACP = theApp.GetProfileInt(_T("eMule"), _T("SetSystemACP"), -1); if (iSetSysACP != -1) return true; iSetSysACP = 0; LCID lcidSystem = GetSystemDefaultLCID(); // Installation, or altered by user in control panel (WinXP) //LCID lcidUser = GetUserDefaultLCID(); // Installation, or altered by user in control panel (WinXP) // get the ANSI code page which is to be used for all non-Unicode conversions. LANGID lidSystem = LANGIDFROMLCID(lcidSystem); // get user's sorting preferences //UINT uSortIdUser = SORTIDFROMLCID(lcidUser); //UINT uSortVerUser = SORTVERSIONFROMLCID(lcidUser); // we can't use the same sorting paramters for 2 different Languages.. UINT uSortIdUser = SORT_DEFAULT; UINT uSortVerUser = 0; // create a thread locale which gives full backward compability for users which had run ANSI emule on // a system where the system's code page did not match the user's language.. LCID lcidSys = MAKESORTLCID(lidSystem, uSortIdUser, uSortVerUser); LCID lcidUsr = GetThreadLocale(); if (lcidUsr != lcidSys) { CString strUsrCP = GetCodePageNameForLocale(lcidUsr); if (!strUsrCP.IsEmpty()) strUsrCP = _T(" \"") + strUsrCP + _T('\"'); CString strSysCP = GetCodePageNameForLocale(lcidSys); if (!strSysCP.IsEmpty()) strSysCP = _T(" \"") + strSysCP + _T('\"'); static const TCHAR szMsg[] = _T("eMule has detected that your current code page%s is not the same as your system's code page%s. For converting non-Unicode data to Unicode, you need to specify which code page to use.\r\n") _T("\r\n") _T("If you want eMule to use your current code page for converting non-Unicode data, click 'Yes'. (If you are using eMule for the first time or if you don't care about this issue at all, choose this option. This is the recommended setting.)\r\n") _T("\r\n") _T("If you want eMule to use your system's code page for converting non-Unicode data, click 'No'. (This will give you more backward compatibility when reading older *.met files created with non-Unicode eMule versions.)\r\n") _T("\r\n") _T("If you want to cancel and create backup of all your configuration files or visit our forum to learn more about this issue, click 'Cancel'.\r\n") ; CString strFullMsg; strFullMsg.Format(szMsg, strUsrCP, strSysCP); int iAnswer = AfxMessageBox(strFullMsg, MB_ICONSTOP | MB_YESNOCANCEL | MB_DEFBUTTON1); if (iAnswer == IDCANCEL) return false; if (iAnswer == IDNO) iSetSysACP = 1; } VERIFY( theApp.WriteProfileInt(_T("eMule"), _T("SetSystemACP"), iSetSysACP) ); return true; }
int APIENTRY lstrcmpA( LPCSTR lpString1, LPCSTR lpString2 ) { int retval; retval = CompareStringA( GetThreadLocale(), LOCALE_USE_CP_ACP, lpString1, -1, lpString2, -1 ); if (retval == 0) { // // The caller is not expecting failure. Try the system // default locale id. // retval = CompareStringA( GetSystemDefaultLCID(), LOCALE_USE_CP_ACP, lpString1, -1, lpString2, -1 ); } if (retval == 0) { if (lpString1 && lpString2) { // // The caller is not expecting failure. We've never had a // failure indicator before. We'll do a best guess by calling // the C runtimes to do a non-locale sensitive compare. // return strcmp(lpString1, lpString2); } else if (lpString1) { return (1); } else if (lpString2) { return (-1); } else { return (0); } } return (retval - 2); }
/*! * \brief * Get the default CodePage of the current system * * \returns * The identifier of the current system's codepage (e.g. 1252 for ANSI Latin 1; Western European (Windows)) * * \see * http://www.torsten-horn.de/techdocs/encoding.htm | http://msdn.microsoft.com/en-us/library/windows/desktop/dd317756%28v=vs.85%29.aspx */ int getCurrentSystemCodePage(){ WCHAR szCodePage[10]; int cch= GetLocaleInfoW( GetSystemDefaultLCID(), // or any LCID you may be interested in LOCALE_IDEFAULTCODEPAGE, szCodePage, sizeof(szCodePage)/sizeof(WCHAR)); return cch>0 ? _wtoi(szCodePage) : 0; }
/* OnInitDone * ---------------------------------------------------------------------------- */ void CFolderDialog::OnInitDone() { HideControl(stc2); HideControl(cmb1); CWnd* pFD = GetParent(); LCID lcid = GetSystemDefaultLCID(); switch(PRIMARYLANGID(LANGIDFROMLCID(lcid))) { default: case LANG_ENGLISH: SetControlText(stc3, "Folder:"); SetControlText(IDOK, "&Select"); pFD->SetWindowText("Select Folder"); break; case LANG_GERMAN: SetControlText(stc3, "Verzeichnis:"); SetControlText(IDOK, "&Auswahl"); pFD->SetWindowText("Verzeichnis auswählen"); break; } SetControlText(edt1, m_sSelPath); CRect rStatic; pFD->GetDlgItem(stc3)->GetWindowRect(rStatic); pFD->ScreenToClient(rStatic); rStatic.right -= 10; pFD->GetDlgItem(stc3)->SetWindowPos(0, 0, 0, rStatic.Width(), rStatic.Height(), SWP_NOMOVE | SWP_NOZORDER); CRect rectCancel; pFD->GetDlgItem(IDCANCEL)->GetWindowRect(rectCancel); pFD->ScreenToClient(rectCancel); CRect rectOK; pFD->GetDlgItem(IDOK)->GetWindowRect(rectOK); pFD->ScreenToClient(rectOK); pFD->GetDlgItem(IDOK)->SetWindowPos(0,rectCancel.left - rectOK.Width() - 4, rectCancel.top, 0,0, SWP_NOZORDER | SWP_NOSIZE); CRect rList; pFD->GetDlgItem(lst1)->GetWindowRect(rList); pFD->ScreenToClient(rList); CRect rEdit; pFD->GetDlgItem(edt1)->GetWindowRect(rEdit); pFD->ScreenToClient(rEdit); rEdit.left = rStatic.right + 10; pFD->GetDlgItem(edt1)->SetWindowPos(0, rEdit.left, rEdit.top, rList.right - rEdit.left, rEdit.Height(), SWP_NOZORDER); m_fpWndProcDiag = (WNDPROC)SetWindowLong(pFD->m_hWnd, GWL_WNDPROC, (long)WindowProcDiag); m_fpWndProcEdit = (WNDPROC)SetWindowLong(pFD->GetDlgItem(edt1)->m_hWnd, GWL_WNDPROC, (long)WindowProcEdit); }
L00401540() { /* unknown */ void ebp; /* unknown */ void edi; L00401308(edx, eax, ecx, ebx); GetSystemDefaultLCID(); return(GetOEMCP()); }
L004010A0() { /* unknown */ void ebp; (save)edi; L00401518(edx, edx); (restore)edi; GetSystemDefaultLCID(); return(GetDriveTypeW(0)); }
L0040155C() { /* unknown */ void ebp; GetSystemDefaultLCID(); (save)edi; L0040138C(ecx, ecx, edx); (restore)edi; return(GetUserDefaultLangID()); }
L00401468() { /* unknown */ void ebp; eax = GetCommandLineA(); (save)edi; L00401540(ebx, eax, eax); (restore)edi; return(GetSystemDefaultLCID()); }
static LONG APIENTRY Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam) { TCHAR Caption[BUFFERSIZE]; PROPSHEETPAGE psp[3]; PROPSHEETHEADER psh; PGLOBALDATA pGlobalData; LONG ret; if (OpenSetupInf()) { ParseSetupInf(); } pGlobalData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GLOBALDATA)); if (pGlobalData == NULL) return FALSE; pGlobalData->SystemLCID = GetSystemDefaultLCID(); pGlobalData->bIsUserAdmin = IsUserAdmin(); LoadString(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR)); ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); psh.dwSize = sizeof(PROPSHEETHEADER); psh.dwFlags = PSH_PROPSHEETPAGE; psh.hwndParent = hCPLWindow; psh.hInstance = hApplet; psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON)); psh.pszCaption = Caption; psh.nPages = 0; //sizeof(psp) / sizeof(PROPSHEETPAGE); psh.nStartPage = 0; psh.ppsp = psp; InitIntlPropSheetPage(&psp[0], IDD_GENERALPAGE, GeneralPageProc, (LPARAM)pGlobalData); psh.nPages++; InitIntlPropSheetPage(&psp[1], IDD_LANGUAGESPAGE, LanguagesPageProc, (LPARAM)pGlobalData); psh.nPages++; if (pGlobalData->bIsUserAdmin) { InitIntlPropSheetPage(&psp[2], IDD_ADVANCEDPAGE, AdvancedPageProc, (LPARAM)pGlobalData); psh.nPages++; } ret = (LONG)(PropertySheet(&psh) != -1); HeapFree(GetProcessHeap(), 0, pGlobalData); return ret; }
HRESULT GetDispatchProperty(IDispatch* pDisp, LPOLESTR lpName, VARIANT* pRes) { #ifdef _DEBUG ITypeInfoPtr pTypeInfo; LPTYPEATTR pTypeAttr; pDisp->GetTypeInfo(1, GetSystemDefaultLCID(), &pTypeInfo); pTypeInfo->GetTypeAttr(&pTypeAttr); pTypeInfo->ReleaseTypeAttr(pTypeAttr); #endif DISPID DispId = 0; HRESULT hr = pDisp->GetIDsOfNames(IID_NULL, &lpName, 1, GetSystemDefaultLCID(), &DispId); if (hr != S_OK) return hr; _variant_t varRes; unsigned int ArgError; DISPPARAMS Params; Params.cArgs = 0; Params.rgvarg = NULL; Params.cNamedArgs = 0; Params.rgdispidNamedArgs = NULL; hr = pDisp->Invoke(DispId, IID_NULL, GetSystemDefaultLCID(), DISPATCH_PROPERTYGET, &Params, pRes, NULL, &ArgError); return hr; }
//////////////////////////////////////////////////////////////////////// // HRESULT DisplayErrorRecords // ///////////////////////////////////////////////////////////////////////////// HRESULT DisplayErrorRecords(HWND hWnd, ULONG cRecords, IErrorRecords* pIErrorRecords, WCHAR* pwszFile, ULONG ulLine) { HRESULT hr = S_OK; IErrorInfo* pIErrorInfo = NULL; BSTR bstrErrorInfo = NULL; BSTR bstrSQLInfo = NULL; LCID lcid = GetSystemDefaultLCID(); //Get the Error Records if(cRecords && pIErrorRecords) { LONG lNativeError = 0; ERRORINFO ErrorInfo; //Loop through the records for(ULONG i=0; i<cRecords; i++) { //GetErrorInfo XTESTC(hr = pIErrorRecords->GetErrorInfo(i,lcid,&pIErrorInfo)); //Get the Description XTESTC(hr = pIErrorInfo->GetDescription(&bstrErrorInfo)); //Get the Basic ErrorInfo XTESTC(hr = pIErrorRecords->GetBasicErrorInfo(i,&ErrorInfo)); //Get the SQL Info GetSqlErrorInfo(i, pIErrorRecords, &bstrSQLInfo); //Display the Error if(bstrSQLInfo) wMessageBox(hWnd, (hWnd ? MB_APPLMODAL : MB_TASKMODAL) | MB_ICONEXCLAMATION | MB_OK, wsz_ERRORINFO, L"Interface: %s\nResult: %x = %s\n\nIErrorInfo: [%s] %s\n\nFile: %s\nLine: %d", GetInterfaceName(ErrorInfo.iid), ErrorInfo.hrError, GetErrorName(ErrorInfo.hrError), bstrSQLInfo, bstrErrorInfo, pwszFile, ulLine); else wMessageBox(hWnd, (hWnd ? MB_APPLMODAL : MB_TASKMODAL) | MB_ICONEXCLAMATION | MB_OK, wsz_ERRORINFO, L"Interface: %s\nResult: %x = %s\n\nIErrorInfo: %s\n\nFile: %s\nLine: %d", GetInterfaceName(ErrorInfo.iid), ErrorInfo.hrError, GetErrorName(ErrorInfo.hrError), bstrErrorInfo, pwszFile, ulLine); SAFE_RELEASE(pIErrorInfo); SAFE_SYSFREE(bstrErrorInfo); SAFE_SYSFREE(bstrSQLInfo); } } CLEANUP: SAFE_RELEASE(pIErrorInfo); SAFE_SYSFREE(bstrErrorInfo); SAFE_SYSFREE(bstrSQLInfo); return hr; }
void DisplayOLEDBErrorRecords(HRESULT hrErr = S_OK) { CDBErrorInfo ErrorInfo; ULONG cRecords; HRESULT hr; ULONG i; CComBSTR bstrDesc, bstrHelpFile, bstrSource; GUID guid; DWORD dwHelpContext; WCHAR wszGuid[40]; USES_CONVERSION; TCERRLOG_BEGIN_SIZE(_MAX_PATH * 8); // If the user passed in an HRESULT then trace it if (hrErr != S_OK) { TCERRLOG_PART1("OLE DB Error Record dump for hr = 0x%x\n", hrErr); } LCID lcLocale = GetSystemDefaultLCID(); hr = ErrorInfo.GetErrorRecords(&cRecords); if (FAILED(hr) && ErrorInfo.m_spErrorInfo == NULL) { TCERRLOG_PART1("No OLE DB Error Information found: hr = 0x%x\n", hr); } else { for (i = 0; i < cRecords; i++) { hr = ErrorInfo.GetAllErrorInfo(i, lcLocale, &bstrDesc, &bstrSource, &guid, &dwHelpContext, &bstrHelpFile); if (FAILED(hr)) { TCERRLOG_PART1("OLE DB Error Record dump retrieval failed: hr = 0x%x\n", hr ); return; } StringFromGUID2(guid, wszGuid, sizeof(wszGuid) / sizeof(WCHAR)); TCERRLOG_PART5( "Source:\"%ls\"\nDescription:\"%ls\"\nHelp File:\"%ls\"\nHelp Context:%4d\nGUID:%ls\n", bstrSource, bstrDesc, bstrHelpFile, dwHelpContext, wszGuid); bstrSource.Empty(); bstrDesc.Empty(); bstrHelpFile.Empty(); } } TCERRLOG_END }
L004013C4() { /* unknown */ void ebp; GetSystemDefaultLCID(); (save)edi; L0040101C(ecx, ebx, esi, edx); (restore)edi; eax = edi + 2708; do { GetModuleHandleW(eax); } while(eax != 0); }
static int set_clipboard(lua_State* L) { if ( lua_isstring(L, 1) ) { size_t textLen; const char *textData = lua_tolstring( L, 1, &textLen ); LPTSTR lptstrCopy; HGLOBAL hglbCopy; int i=0; while (!OpenClipboard(NULL)) { Sleep(10); i++; if (i>100) return 0; } EmptyClipboard(); hglbCopy = GlobalAlloc(GMEM_DDESHARE, (textLen + 1) * sizeof(TCHAR)); if (hglbCopy == NULL) { CloseClipboard(); return 0; } // Lock the handle and copy the text to the buffer. lptstrCopy = (LPSTR)GlobalLock(hglbCopy); lstrcpy(lptstrCopy,textData); GlobalUnlock(hglbCopy); // Place the handle on the clipboard. SetClipboardData(CF_TEXT, hglbCopy); hglbCopy = GlobalAlloc(GMEM_DDESHARE,sizeof(LCID)); LCID *lcid=(LCID*)GlobalLock(hglbCopy); *lcid=GetSystemDefaultLCID(); GlobalUnlock(hglbCopy); SetClipboardData(CF_LOCALE, hglbCopy); CloseClipboard(); return 0; } return 0; }
static LANGID GetGUILanguage(void) { if (gui_language != 0) return gui_language; HKEY regkey; DWORD value = 0; LONG status = RegOpenKeyEx(HKEY_CURRENT_USER, GUI_REGKEY_HKCU, 0, KEY_READ, ®key); if (status == ERROR_SUCCESS) GetRegistryValueNumeric(regkey, _T("ui_language"), &value); gui_language = ( value != 0 ? value : LANGIDFROMLCID(GetSystemDefaultLCID()) ); InitMUILanguage(gui_language); return gui_language; }
const char* default_codeset (void) { const char* fromcode = 0; #if defined HAVE_LOCALE_CHARSET debug_printf ("Using locale_charset() to get system codeset.\n"); fromcode = locale_charset (); #elif defined HAVE_LANGINFO_CODESET debug_printf ("Using nl_langinfo() to get system codeset.\n"); fromcode = nl_langinfo (CODESET); #else debug_printf ("No way to get system codeset.\n"); #endif if (!fromcode || !fromcode[0]) { debug_printf ("No default codeset, using ISO-8859-1.\n"); fromcode = "ISO-8859-1"; } else { debug_printf ("Found default codeset %s\n", fromcode); } #if defined (WIN32) { /* This is just for debugging */ LCID lcid; lcid = GetSystemDefaultLCID (); debug_printf ("SystemDefaultLCID: %04x\n", lcid); lcid = GetUserDefaultLCID (); debug_printf ("UserDefaultLCID: %04x\n", lcid); } #endif #if defined HAVE_ICONV debug_printf ("Have iconv.\n"); #else debug_printf ("No iconv.\n"); #endif return fromcode; }
void log_system_data(void) { char buf[256]; unsigned int langid,lcid,size=80; char systemdir[256],windir[256],cdir[256],user[256],computer[256]; langid=GetSystemDefaultLangID(); lcid=GetSystemDefaultLCID(); GetSystemDirectory(systemdir,80); GetWindowsDirectory(windir,80); GetCurrentDirectory(80,cdir); GetUserName((void*)user,&size); size=80; GetComputerName((void*)computer,&size); sprintf(buf,"|langid=%u, lcid=%u",langid,lcid); say(buf); sprintf(buf,"|systemdir=\"%s\"",systemdir); say(buf); sprintf(buf,"|windowsdir=\"%s\"",windir); say(buf); sprintf(buf,"|currentdir=\"%s\"",cdir); say(buf); sprintf(buf,"|username=\"%s\"",user); say(buf); sprintf(buf,"|computername=\"%s\"",computer); say(buf); }
HRESULT InitSystemMetricValues(THREADSTATE* pts) { HIGHCONTRAST hc; HFONT hfontOld; TEXTMETRIC tm; InterlockedIncrement(&g_cMetricChange); if(!pts->hdcDesktop) { pts->hdcDesktop = CreateCompatibleDC(NULL); if(!pts->hdcDesktop) { RRETURN(E_OUTOFMEMORY); } } _afxGlobalData._sizePixelsPerInch.cx = GetDeviceCaps(pts->hdcDesktop, LOGPIXELSX); _afxGlobalData._sizePixelsPerInch.cy = GetDeviceCaps(pts->hdcDesktop, LOGPIXELSY); g_sizeDragMin.cx = GetSystemMetrics(SM_CXDRAG); g_sizeDragMin.cy = GetSystemMetrics(SM_CYDRAG); _afxGlobalData._sizeScrollbar.cx = GetSystemMetrics(SM_CXVSCROLL); _afxGlobalData._sizeScrollbar.cy = GetSystemMetrics(SM_CYHSCROLL); _afxGlobalData._sizelScrollbar.cx = HimetricFromHPix(_afxGlobalData._sizeScrollbar.cx); _afxGlobalData._sizelScrollbar.cy = HimetricFromVPix(_afxGlobalData._sizeScrollbar.cy); // System font info hfontOld = (HFONT)SelectObject(pts->hdcDesktop, GetStockObject(SYSTEM_FONT)); if(hfontOld) { GetTextMetrics(pts->hdcDesktop, &tm); g_sizeSystemChar.cx = tm.tmAveCharWidth; g_sizeSystemChar.cy = tm.tmHeight; SelectObject(pts->hdcDesktop, hfontOld); } else { g_sizeSystemChar.cx = g_sizeSystemChar.cy = 10; } // Locale info _afxGlobalData._cpDefault = GetACP(); _afxGlobalData._lcidUserDefault = GetSystemDefaultLCID(); // Set Global Locale ID GetSystemNumberSettings(&_afxGlobalData._iNumShape, &_afxGlobalData._uLangNationalDigits); // Accessibility info SystemParametersInfo(SPI_GETSCREENREADER, 0, &g_fScreenReader, FALSE); memset(&hc, 0, sizeof(HIGHCONTRAST)); hc.cbSize = sizeof(HIGHCONTRAST); if(SystemParametersInfo(SPI_GETHIGHCONTRAST, sizeof(HIGHCONTRAST), &hc, 0)) { _afxGlobalData._fHighContrastMode = !!(hc.dwFlags & HCF_HIGHCONTRASTON); } else { Trace1("SPI failed with error %x\n", GetLastError()); } RRETURN(S_OK); }
void CPreferences::InitThreadLocale() { ASSERT( m_wLanguageID != 0 ); // NOTE: This function is for testing multi language support only. // NOTE: This function is *NOT* to be enabled in release builds nor to be offered by any Mod! if (theApp.GetProfileInt(_T("eMule"), _T("SetLanguageACP"), 0) != 0) { //LCID lcidUser = GetUserDefaultLCID(); // Installation, or altered by user in control panel (WinXP) // get the ANSI codepage which is to be used for all non-Unicode conversions. LANGID lidSystem = m_wLanguageID; // get user's sorting preferences //UINT uSortIdUser = SORTIDFROMLCID(lcidUser); //UINT uSortVerUser = SORTVERSIONFROMLCID(lcidUser); // we can't use the same sorting paramters for 2 different Languages.. UINT uSortIdUser = SORT_DEFAULT; UINT uSortVerUser = 0; // set thread locale, this is used for: // - MBCS->Unicode conversions (e.g. search results). // - Unicode->MBCS conversions (e.g. publishing local files (names) in network, or savint text files on local disk)... LCID lcid = MAKESORTLCID(lidSystem, uSortIdUser, uSortVerUser); SetThreadLocale(lcid); // if we set the thread locale (see comments above) we also have to specify the proper // codepage for the C-RTL, otherwise we may not be able to store some strings as MBCS // (Unicode->MBCS conversion may fail) SetRtlLocale(lcid); } else if (theApp.GetProfileInt(_T("eMule"), _T("SetSystemACP"), 0) != 0) { LCID lcidSystem = GetSystemDefaultLCID(); // Installation, or altered by user in control panel (WinXP) //LCID lcidUser = GetUserDefaultLCID(); // Installation, or altered by user in control panel (WinXP) // get the ANSI codepage which is to be used for all non-Unicode conversions. LANGID lidSystem = LANGIDFROMLCID(lcidSystem); // get user's sorting preferences //UINT uSortIdUser = SORTIDFROMLCID(lcidUser); //UINT uSortVerUser = SORTVERSIONFROMLCID(lcidUser); // we can't use the same sorting paramters for 2 different Languages.. UINT uSortIdUser = SORT_DEFAULT; UINT uSortVerUser = 0; // create a thread locale which gives full backward compability for users which had run ANSI emule on // a system where the system's code page did not match the user's language.. LCID lcid = MAKESORTLCID(lidSystem, uSortIdUser, uSortVerUser); LCID lcidThread = GetThreadLocale(); if (lcidThread != lcid) { TRACE("+++ Setting thread locale: 0x%08x\n", lcid); SetThreadLocale(lcid); // if we set the thread locale (see comments above) we also have to specify the proper // codepage for the C-RTL, otherwise we may not be able to store some strings as MBCS // (Unicode->MBCS conversion may fail) SetRtlLocale(lcid); } } }
// // nsLocaleService methods // nsLocaleService::nsLocaleService(void) : mSystemLocale(0), mApplicationLocale(0) { #ifdef XP_WIN nsCOMPtr<nsIWin32Locale> win32Converter = do_GetService(NS_WIN32LOCALE_CONTRACTID); NS_ASSERTION(win32Converter, "nsLocaleService: can't get win32 converter\n"); nsAutoString xpLocale; if (win32Converter) { nsresult result; // // get the system LCID // LCID win_lcid = GetSystemDefaultLCID(); if (win_lcid==0) { return;} result = win32Converter->GetXPLocale(win_lcid, xpLocale); if (NS_FAILED(result)) { return;} result = NewLocale(xpLocale, getter_AddRefs(mSystemLocale)); if (NS_FAILED(result)) { return;} // // get the application LCID // win_lcid = GetUserDefaultLCID(); if (win_lcid==0) { return;} result = win32Converter->GetXPLocale(win_lcid, xpLocale); if (NS_FAILED(result)) { return;} result = NewLocale(xpLocale, getter_AddRefs(mApplicationLocale)); if (NS_FAILED(result)) { return;} } #endif #if (defined(XP_UNIX) && !defined(XP_MACOSX)) || defined(XP_BEOS) || defined(XP_AMIGAOS) nsCOMPtr<nsIPosixLocale> posixConverter = do_GetService(NS_POSIXLOCALE_CONTRACTID); nsAutoString xpLocale, platformLocale; if (posixConverter) { nsAutoString category, category_platform; int i; nsRefPtr<nsLocale> resultLocale(new nsLocale()); if ( resultLocale == NULL ) { return; } #ifdef MOZ_WIDGET_QT const char* lang = QLocale::languageToString(QLocale::system().language()).toAscii(); #else // Get system configuration const char* lang = getenv("LANG"); #endif for( i = 0; i < LocaleListLength; i++ ) { nsresult result; // setlocale( , "") evaluates LC_* and LANG char* lc_temp = setlocale(posix_locale_category[i], ""); CopyASCIItoUTF16(LocaleList[i], category); category_platform = category; category_platform.AppendLiteral("##PLATFORM"); if (lc_temp != nsnull) { result = posixConverter->GetXPLocale(lc_temp, xpLocale); CopyASCIItoUTF16(lc_temp, platformLocale); } else { if ( lang == nsnull ) { platformLocale.AssignLiteral("en_US"); result = posixConverter->GetXPLocale("en-US", xpLocale); } else { CopyASCIItoUTF16(lang, platformLocale); result = posixConverter->GetXPLocale(lang, xpLocale); } } if (NS_FAILED(result)) { return; } resultLocale->AddCategory(category, xpLocale); resultLocale->AddCategory(category_platform, platformLocale); } mSystemLocale = do_QueryInterface(resultLocale); mApplicationLocale = do_QueryInterface(resultLocale); } // if ( NS_SUCCEEDED )... #endif // XP_UNIX || XP_BEOS #ifdef XP_OS2 nsCOMPtr<nsIOS2Locale> os2Converter = do_GetService(NS_OS2LOCALE_CONTRACTID); nsAutoString xpLocale; if (os2Converter) { nsAutoString category; int i; nsRefPtr<nsLocale> resultLocale(new nsLocale()); if ( resultLocale == NULL ) { return; } LocaleObject locale_object = NULL; int result = UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"", &locale_object); if (result != ULS_SUCCESS) { int result = UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"en_US", &locale_object); } char* lc_temp; for( i = 0; i < LocaleListLength; i++ ) { lc_temp = nsnull; UniQueryLocaleObject(locale_object, posix_locale_category[i], UNI_MBS_STRING_POINTER, (void **)&lc_temp); category.AssignWithConversion(LocaleList[i]); nsresult result; if (lc_temp != nsnull) result = os2Converter->GetXPLocale(lc_temp, xpLocale); else { char* lang = getenv("LANG"); if ( lang == nsnull ) { result = os2Converter->GetXPLocale("en-US", xpLocale); } else result = os2Converter->GetXPLocale(lang, xpLocale); } if (NS_FAILED(result)) { UniFreeMem(lc_temp); UniFreeLocaleObject(locale_object); return; } resultLocale->AddCategory(category, xpLocale); UniFreeMem(lc_temp); } UniFreeLocaleObject(locale_object); mSystemLocale = do_QueryInterface(resultLocale); mApplicationLocale = do_QueryInterface(resultLocale); } // if ( NS_SUCCEEDED )... #endif // XP_OS2 #ifdef XP_MACOSX // Get string representation of user's current locale CFLocaleRef userLocaleRef = ::CFLocaleCopyCurrent(); CFStringRef userLocaleStr = ::CFLocaleGetIdentifier(userLocaleRef); ::CFRetain(userLocaleStr); nsAutoTArray<UniChar, 32> buffer; int size = ::CFStringGetLength(userLocaleStr); if (buffer.SetLength(size + 1)) { CFRange range = ::CFRangeMake(0, size); ::CFStringGetCharacters(userLocaleStr, range, buffer.Elements()); buffer[size] = 0; // Convert the locale string to the format that Mozilla expects nsAutoString xpLocale(buffer.Elements()); xpLocale.ReplaceChar('_', '-'); nsresult rv = NewLocale(xpLocale, getter_AddRefs(mSystemLocale)); if (NS_SUCCEEDED(rv)) { mApplicationLocale = mSystemLocale; } } ::CFRelease(userLocaleStr); ::CFRelease(userLocaleRef); NS_ASSERTION(mApplicationLocale, "Failed to create locale objects"); #endif // XP_MACOSX }
/****************************************************************************** * GetSystemDefaultLCID [OLE2NLS.2] */ LCID WINAPI GetSystemDefaultLCID16(void) { return GetSystemDefaultLCID(); }
BOOL TSetupSheet::SetData() { if (resId == MAIN_SHEET) { if (sv) { sv->bufSize = cfg->bufSize; sv->estimateMode = cfg->estimateMode; sv->ignoreErr = cfg->ignoreErr; sv->enableVerify = cfg->enableVerify; sv->enableAcl = cfg->enableAcl; sv->enableStream = cfg->enableStream; sv->speedLevel = cfg->speedLevel; sv->isExtendFilter = cfg->isExtendFilter; sv->enableOwdel = cfg->enableOwdel; } SetDlgItemInt(BUFSIZE_EDIT, cfg->bufSize); CheckDlgButton(ESTIMATE_CHECK, cfg->estimateMode); CheckDlgButton(IGNORE_CHECK, cfg->ignoreErr); CheckDlgButton(VERIFY_CHECK, cfg->enableVerify); CheckDlgButton(ACL_CHECK, cfg->enableAcl); CheckDlgButton(STREAM_CHECK, cfg->enableStream); SendDlgItemMessage(SPEED_SLIDER, TBM_SETRANGE, 0, MAKELONG(SPEED_SUSPEND, SPEED_FULL)); SetSpeedLevelLabel(this, cfg->speedLevel); CheckDlgButton(EXTENDFILTER_CHECK, cfg->isExtendFilter); CheckDlgButton(OWDEL_CHECK, cfg->enableOwdel); } else if (resId == IO_SHEET) { SetDlgItemInt(MAXTRANS_EDIT, cfg->maxTransSize); SetDlgItemInt(MAXOVL_EDIT, cfg->maxOvlNum); CheckDlgButton(READOSBUF_CHECK, cfg->isReadOsBuf); SetDlgItemInt(NONBUFMINNTFS_EDIT, cfg->nbMinSizeNtfs); SetDlgItemInt(NONBUFMINFAT_EDIT, cfg->nbMinSizeFat); } else if (resId == PHYSDRV_SHEET) { SetDlgItemText(DRIVEMAP_EDIT, cfg->driveMap); SendDlgItemMessage(NETDRVMODE_COMBO, CB_ADDSTRING, 0, (LPARAM)GetLoadStr(IDS_NETDRV_UNC)); SendDlgItemMessage(NETDRVMODE_COMBO, CB_ADDSTRING, 0, (LPARAM)GetLoadStr(IDS_NETDRV_SVR)); SendDlgItemMessage(NETDRVMODE_COMBO, CB_ADDSTRING, 0, (LPARAM)GetLoadStr(IDS_NETDRV_ALL)); SendDlgItemMessage(NETDRVMODE_COMBO, CB_SETCURSEL, cfg->netDrvMode, 0); } else if (resId == PARALLEL_SHEET) { SetDlgItemInt(MAXRUN_EDIT, cfg->maxRunNum); CheckDlgButton(FORCESTART_CHECK, cfg->forceStart); } else if (resId == COPYOPT_SHEET) { CheckDlgButton(SAMEDIR_RENAME_CHECK, cfg->isSameDirRename); CheckDlgButton(EMPTYDIR_CHECK, cfg->skipEmptyDir); CheckDlgButton(REPARSE_CHECK, cfg->isReparse); ::EnableWindow(GetDlgItem(REPARSE_CHECK), TRUE); CheckDlgButton(MOVEATTR_CHECK, cfg->enableMoveAttr); CheckDlgButton(SERIALMOVE_CHECK, cfg->serialMove); CheckDlgButton(SERIALVERIFYMOVE_CHECK, cfg->serialVerifyMove); SetDlgItemInt(TIMEGRACE_EDIT, cfg->timeDiffGrace); } else if (resId == DEL_SHEET) { CheckDlgButton(NSA_CHECK, cfg->enableNSA); CheckDlgButton(DELDIR_CHECK, cfg->delDirWithFilter); } else if (resId == LOG_SHEET) { SetDlgItemInt(HISTORY_EDIT, cfg->maxHistoryNext); CheckDlgButton(ERRLOG_CHECK, cfg->isErrLog); CheckDlgButton(UTF8LOG_CHECK, cfg->isUtf8Log); ::EnableWindow(GetDlgItem(UTF8LOG_CHECK), TRUE); CheckDlgButton(FILELOG_CHECK, cfg->fileLogMode); CheckDlgButton(TIMESTAMP_CHECK, (cfg->fileLogFlags & FastCopy::FILELOG_TIMESTAMP) ? TRUE : FALSE); CheckDlgButton(FILESIZE_CHECK, (cfg->fileLogFlags & FastCopy::FILELOG_FILESIZE) ? TRUE : FALSE); CheckDlgButton(ACLERRLOG_CHECK, cfg->aclErrLog); ::EnableWindow(GetDlgItem(ACLERRLOG_CHECK), TRUE); CheckDlgButton(STREAMERRLOG_CHECK, cfg->streamErrLog); ::EnableWindow(GetDlgItem(STREAMERRLOG_CHECK), TRUE); } else if (resId == MISC_SHEET) { CheckDlgButton(EXECCONFIRM_CHECK, cfg->execConfirm); CheckDlgButton(TASKBAR_CHECK, cfg->taskbarMode); CheckDlgButton(SPAN1_RADIO + cfg->infoSpan, 1); if ((cfg->lcid != -1 || GetSystemDefaultLCID() == 0x411)) { ::ShowWindow(GetDlgItem(LCID_CHECK), SW_SHOW); ::EnableWindow(GetDlgItem(LCID_CHECK), TRUE); CheckDlgButton(LCID_CHECK, cfg->lcid == -1 || cfg->lcid == 0x411 ? FALSE : TRUE); } } return TRUE; }
// // nsLocaleService methods // nsLocaleService::nsLocaleService(void) { #ifdef XP_WIN nsAutoString xpLocale; // // get the system LCID // LCID win_lcid = GetSystemDefaultLCID(); NS_ENSURE_TRUE_VOID(win_lcid); nsWin32Locale::GetXPLocale(win_lcid, xpLocale); nsresult rv = NewLocale(xpLocale, getter_AddRefs(mSystemLocale)); NS_ENSURE_SUCCESS_VOID(rv); // // get the application LCID // win_lcid = GetUserDefaultLCID(); NS_ENSURE_TRUE_VOID(win_lcid); nsWin32Locale::GetXPLocale(win_lcid, xpLocale); rv = NewLocale(xpLocale, getter_AddRefs(mApplicationLocale)); NS_ENSURE_SUCCESS_VOID(rv); #endif #if defined(XP_UNIX) && !defined(XP_MACOSX) nsRefPtr<nsLocale> resultLocale(new nsLocale()); NS_ENSURE_TRUE_VOID(resultLocale); #ifdef MOZ_WIDGET_QT const char* lang = QLocale::system().name().toUtf8(); #else // Get system configuration const char* lang = getenv("LANG"); #endif nsAutoString xpLocale, platformLocale; nsAutoString category, category_platform; int i; for( i = 0; i < LocaleListLength; i++ ) { nsresult result; // setlocale( , "") evaluates LC_* and LANG char* lc_temp = setlocale(posix_locale_category[i], ""); CopyASCIItoUTF16(LocaleList[i], category); category_platform = category; category_platform.AppendLiteral("##PLATFORM"); if (lc_temp != nullptr) { result = nsPosixLocale::GetXPLocale(lc_temp, xpLocale); CopyASCIItoUTF16(lc_temp, platformLocale); } else { if ( lang == nullptr ) { platformLocale.AssignLiteral("en_US"); result = nsPosixLocale::GetXPLocale("en-US", xpLocale); } else { CopyASCIItoUTF16(lang, platformLocale); result = nsPosixLocale::GetXPLocale(lang, xpLocale); } } if (NS_FAILED(result)) { return; } resultLocale->AddCategory(category, xpLocale); resultLocale->AddCategory(category_platform, platformLocale); } mSystemLocale = do_QueryInterface(resultLocale); mApplicationLocale = do_QueryInterface(resultLocale); #endif // XP_UNIX #ifdef XP_MACOSX // Get string representation of user's current locale CFLocaleRef userLocaleRef = ::CFLocaleCopyCurrent(); CFStringRef userLocaleStr = ::CFLocaleGetIdentifier(userLocaleRef); ::CFRetain(userLocaleStr); nsAutoTArray<UniChar, 32> buffer; int size = ::CFStringGetLength(userLocaleStr); if (buffer.SetLength(size + 1)) { CFRange range = ::CFRangeMake(0, size); ::CFStringGetCharacters(userLocaleStr, range, buffer.Elements()); buffer[size] = 0; // Convert the locale string to the format that Mozilla expects nsAutoString xpLocale(buffer.Elements()); xpLocale.ReplaceChar('_', '-'); nsresult rv = NewLocale(xpLocale, getter_AddRefs(mSystemLocale)); if (NS_SUCCEEDED(rv)) { mApplicationLocale = mSystemLocale; } } ::CFRelease(userLocaleStr); ::CFRelease(userLocaleRef); NS_ASSERTION(mApplicationLocale, "Failed to create locale objects"); #endif // XP_MACOSX }
BOOL PrintFileHeader( FILE * fp ) { TCHAR str[ 1024 ]; _fputts( APP_NAME, fp ); #ifdef _UNICODE _fputts( TEXT( " (Unicode)\r\n" ), fp ); #else _fputts( TEXT( " (ANSI)\r\n" ), fp ); #endif SYSTEMTIME st; GetLocalTime( &st ); TIME_ZONE_INFORMATION tzi; GetTimeZoneInformation( &tzi ); int tz = abs( (int) tzi.Bias ); int tz_sign = ( tzi.Bias < 0 ) ? ( +1 ) : ( -1 ) ; // if Bias is negative, TZ is positive int tz_h = tz / 60; int tz_m = tz - tz_h * 60; wsprintf( str, TEXT( " %4d-%02d-%02d %02d:%02d:%02d.%03d%s%02d:%02d\r\n\r\n" ), st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds, tz_sign > 0 ? TEXT( "+" ) : TEXT( "-" ), tz_h, tz_m ); _fputts( str, fp ); OSVERSIONINFO osvi; osvi.dwOSVersionInfoSize = sizeof( OSVERSIONINFO ); GetVersionEx( &osvi ); TCHAR tmpstr[ 256 ] = TEXT( "Unknown OS" ); if( osvi.dwMajorVersion == 4UL ) { if( osvi.dwMinorVersion == 0UL ) lstrcpy( tmpstr, TEXT( "Windows NT 4.0" ) ); else if( osvi.dwMinorVersion == 90UL ) lstrcpy( tmpstr, TEXT( "Windows Me" ) ); } else if( osvi.dwMajorVersion == 5UL ) { if( osvi.dwMinorVersion == 0UL ) lstrcpy( tmpstr, TEXT( "Windows 2000" ) ); else if( osvi.dwMinorVersion == 1UL ) lstrcpy( tmpstr, TEXT( "Windows XP" ) ); else if( osvi.dwMinorVersion == 2UL ) lstrcpy( tmpstr, TEXT( "Windows Server 2003 R2, Windows Server 2003, or Windows XP Professional x64 Edition" ) ); } else if( osvi.dwMajorVersion == 6UL ) { if( osvi.dwMinorVersion == 0UL ) lstrcpy( tmpstr, _T( "Windows Vista or Windows Server \"Longhorn\"" ) ); } wsprintf( str, TEXT( "%s ( OS Version: %lu.%lu Build %lu, %s )\r\n" ), tmpstr, osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber, osvi.szCSDVersion ); _fputts( str, fp ); LANGID lang = GetSystemDefaultLangID(); VerLanguageName( (DWORD) lang, tmpstr, 255UL ); wsprintf( str, TEXT( " System Language: %u (%s)\r\n" ), lang, tmpstr ); _fputts( str, fp ); LCID lcid = GetSystemDefaultLCID(); GetLocaleInfo( lcid, LOCALE_SNATIVELANGNAME, tmpstr, 255UL ); wsprintf( str, TEXT( " System Locale: %lu (%s)\r\n" ), lcid, tmpstr ); _fputts( str, fp ); lang = GetUserDefaultLangID(); VerLanguageName( (DWORD) lang, tmpstr, 255UL ); wsprintf( str, TEXT( " User Language: %u (%s)\r\n" ), lang, tmpstr ); _fputts( str, fp ); lcid = GetUserDefaultLCID(); GetLocaleInfo( lcid, LOCALE_SNATIVELANGNAME, tmpstr, 255UL ); wsprintf( str, TEXT( " User Locale: %lu (%s)\r\n" ), lcid, tmpstr ); _fputts( str, fp ); _fputts( TEXT( "\r\n" ), fp ); return TRUE; }