这篇教程C++ GetVersion函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetVersion函数的典型用法代码示例。如果您正苦于以下问题:C++ GetVersion函数的具体用法?C++ GetVersion怎么用?C++ GetVersion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetVersion函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: _Tvoid CBase_SampleChart::OnExportData(){ CString file = _T("C:/Points.csv"); CFileDialog mFileDlg(FALSE,_T("csv"),_T("Points"),OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,_T("csv文件|*.csv||"),this); DWORD dwVersion = GetVersion(); DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion))); if (dwVersion < 0x80000000) mFileDlg.m_ofn.lStructSize=88;//显示新的文件对话框 else mFileDlg.m_ofn.lStructSize=76;//显示老的文件对话框 mFileDlg.m_ofn.lpstrTitle= _T("保存到文件"); if(mFileDlg.DoModal() !=IDOK ) return; file = mFileDlg.GetPathName(); CString strSep = _T(","); CFile f; BOOL ret = f.Open(file,CFile::modeCreate | CFile::modeReadWrite); if(!ret) { MessageBox(_T("打开文件失败,可能是文件为只读属性或被占用")); return; } CString line(_T("时间")); // CArray<CChartSerie*, CChartSerie*> series; series.Add(m_pcCurveMain); unsigned maxCount = 0; CChartSerie* pSerieOfMaxCount = NULL; for(int i=0; i<=series.GetUpperBound(); ++i) { CChartSerie* pS = series.GetAt(i); unsigned c = pS->GetPointsCount(); if(c > maxCount) { maxCount = c; pSerieOfMaxCount = pS; } line = line + strSep + pS->GetName().c_str(); } //标题列 { TWen_USES_CONVERSION; LPCSTR s=TWen_CT2A(line + _T("/r/n")); f.Write(s,strlen(s)); } for(size_t i=0; i<maxCount; i++) { line.Format(_T("%.15f"), pSerieOfMaxCount->m_vPoints.m_pPoints[i].x); for(int j=0; j<=series.GetUpperBound(); ++j) { CChartSerie* pS = GetSerieByIndex(j); unsigned c = pS->GetPointsCount(); CString v; if(c > i) v.Format(_T("%.15f"), pS->m_vPoints.m_pPoints[i].y); line = line + strSep + v; } { TWen_USES_CONVERSION; LPCSTR s=TWen_CT2A(line + _T("/r/n")); f.Write(s,strlen(s)); } } f.Close(); MessageBox(_T("数据已保存到文件[")+file+_T("]"));}
开发者ID:Wanghuaichen,项目名称:SignalProcess,代码行数:65,
示例2: syncDirvoid WindowsPlatform::syncFolderAdded(QString syncPath, QString syncName){ if (syncPath.startsWith(QString::fromAscii("////?//"))) { syncPath = syncPath.mid(4); } if (!syncPath.size()) { return; } QDir syncDir(syncPath); if (!syncDir.exists()) { return; } DWORD dwVersion = GetVersion(); DWORD dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); int iconIndex = (dwMajorVersion<6) ? 2 : 3; QString infoTip = QCoreApplication::translate("WindowsPlatform", "MEGA synced folder"); SHFOLDERCUSTOMSETTINGS fcs = {0}; fcs.dwSize = sizeof(SHFOLDERCUSTOMSETTINGS); fcs.dwMask = FCSM_ICONFILE | FCSM_INFOTIP; fcs.pszIconFile = (LPWSTR)MegaApplication::applicationFilePath().utf16(); fcs.iIconIndex = iconIndex; fcs.pszInfoTip = (LPWSTR)infoTip.utf16(); SHGetSetFolderCustomSettings(&fcs, (LPCWSTR)syncPath.utf16(), FCS_FORCEWRITE); WCHAR path[MAX_PATH]; HRESULT res = SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, path); if (res != S_OK) { return; } QString linksPath = QString::fromWCharArray(path); linksPath += QString::fromAscii("//Links"); QFileInfo info(linksPath); if (!info.isDir()) { return; } QString linkPath = linksPath + QString::fromAscii("//") + syncName + QString::fromAscii(".lnk"); if (QFile(linkPath).exists()) { return; } WCHAR wDescription[]=L"MEGAsync synchronized folder"; linkPath = QDir::toNativeSeparators(linkPath); WCHAR *wLinkPath = (WCHAR *)linkPath.utf16(); syncPath = QDir::toNativeSeparators(syncPath); WCHAR *wSyncPath = (WCHAR *)syncPath.utf16(); QString exec = MegaApplication::applicationFilePath(); exec = QDir::toNativeSeparators(exec); WCHAR *wExecPath = (WCHAR *)exec.utf16(); res = CreateLink(wSyncPath, wLinkPath, wDescription, wExecPath); SHChangeNotify(SHCNE_CREATE, SHCNF_PATH | SHCNF_FLUSHNOWAIT, wLinkPath, NULL); WCHAR *wLinksPath = (WCHAR *)linksPath.utf16(); SHChangeNotify(SHCNE_UPDATEDIR, SHCNF_PATH | SHCNF_FLUSHNOWAIT, wLinksPath, NULL); SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATH | SHCNF_FLUSHNOWAIT, syncPath.utf16(), NULL);}
开发者ID:MasterT8,项目名称:MEGAsync,代码行数:70,
示例3: FMain//-------------------------------------------------------------------------------------------------void FMain(){ if (const HWND hWnd = FindWindowW(g_wGuidClass, nullptr)) PostMessageW(hWnd, WM_CLOSE, 0, 0); if (SUCCEEDED(CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED))) { IMMDeviceEnumerator *immDeviceEnumerator; if (CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_ALL, __uuidof(IMMDeviceEnumerator), reinterpret_cast<LPVOID*>(&immDeviceEnumerator)) == S_OK) { IMMDevice *immDeviceDefault; if (immDeviceEnumerator->GetDefaultAudioEndpoint(eRender, eConsole, &immDeviceDefault) == S_OK) { wchar_t *wIdDefaultOld; HRESULT hr = immDeviceDefault->GetId(&wIdDefaultOld); immDeviceDefault->Release(); if (hr == S_OK) { IMMDeviceCollection *immDeviceCollection; hr = immDeviceEnumerator->EnumAudioEndpoints(eRender, DEVICE_STATE_ACTIVE, &immDeviceCollection); immDeviceEnumerator->Release(); if (hr == S_OK) { UINT iCount; if (immDeviceCollection->GetCount(&iCount) == S_OK) { bool bFail = true; for (UINT i = 0; i < iCount; ++i) { IMMDevice *immDevice; if (immDeviceCollection->Item(i, &immDevice) == S_OK) { wchar_t *wIdEnum; hr = immDevice->GetId(&wIdEnum); immDevice->Release(); if (hr == S_OK) { if (FCompareMemoryW(wIdDefaultOld, wIdEnum)) { bFail = false; if (++i >= iCount) i = 0; hr = immDeviceCollection->Item(i, &immDevice); immDeviceCollection->Release(); if (hr == S_OK) { wchar_t *wIdDefaultNew; if (immDevice->GetId(&wIdDefaultNew) == S_OK) { IPropertyStore *ipStore; hr = immDevice->OpenPropertyStore(STGM_READ, &ipStore); immDevice->Release(); if (hr == S_OK) { PROPVARIANT propFriendlyName; PropVariantInitFix(&propFriendlyName); PROPERTYKEY propKeyFriendlyName; propKeyFriendlyName.fmtid.Data1 = 0xA45C254E; propKeyFriendlyName.fmtid.Data2 = 0xDF1C; propKeyFriendlyName.fmtid.Data3 = 0x4EFD; FCopyMemory(propKeyFriendlyName.fmtid.Data4); propKeyFriendlyName.pid = 14; hr = ipStore->GetValue(propKeyFriendlyName, &propFriendlyName); ipStore->Release(); if (SUCCEEDED(hr)) { IPolicyConfig *pPolicyConfig; if (CoCreateInstance(__uuidof(CPolicyConfigClient), nullptr, CLSCTX_ALL, (GetVersion() & 0xFF) >= 10 ? __uuidof(IPolicyConfigWin10) : __uuidof(IPolicyConfig), reinterpret_cast<LPVOID*>(&pPolicyConfig)) == S_OK) { hr = pPolicyConfig->SetDefaultEndpoint(wIdDefaultNew, eConsole); if (hr == S_OK) { pPolicyConfig->SetDefaultEndpoint(wIdDefaultNew, eMultimedia); pPolicyConfig->SetDefaultEndpoint(wIdDefaultNew, eCommunications); } pPolicyConfig->Release(); if (hr == S_OK) { WNDCLASSEX wndCl; wndCl.cbSize = sizeof(WNDCLASSEX); wndCl.style = 0; wndCl.lpfnWndProc = WindowProc; wndCl.cbClsExtra = 0; wndCl.cbWndExtra = 0; wndCl.hInstance = GetModuleHandleW(nullptr); wndCl.hIcon = nullptr; wndCl.hCursor = nullptr; wndCl.hbrBackground = nullptr; wndCl.lpszMenuName = nullptr; wndCl.lpszClassName = g_wGuidClass; wndCl.hIconSm = nullptr; if (RegisterClassExW(&wndCl)) { if (CreateWindowExW(WS_EX_NOACTIVATE | WS_EX_LAYERED | WS_EX_TOOLWINDOW | WS_EX_TRANSPARENT | WS_EX_TOPMOST, g_wGuidClass, nullptr, WS_POPUP | WS_VISIBLE | WS_MAXIMIZE, 0, 0, 0, 0, nullptr, nullptr, wndCl.hInstance, propFriendlyName.pwszVal)) { MSG msg; while (GetMessageW(&msg, nullptr, 0, 0) > 0) DispatchMessageW(&msg);//.........这里部分代码省略.........
开发者ID:korha,项目名称:SoundCardSwitch,代码行数:101,
示例4: SetupBk//// Installs the BK initial loader and a payload driver depending on current architecture.//WINERROR SetupBk( BOOL IsExe, // specify TRUE if the function called from an EXE file. It will enable UAC elevation and self-delete. BOOL bReboot // specify TRUE if reboot needed after install ){ WINERROR Status; CHAR VersionHi, VersionLo; BOOL Elevated = TRUE; ULONG OsVersion, PayloadSize, BootSize; PCHAR MutexName = NULL, KeyName = NULL, Payload = NULL, BootLoader = NULL; HKEY hKey; HANDLE hMutex = 0; do // not a loop { // Generating pseudo-random program key name if (!GetProgramKeyName(&KeyName, &MutexName)) { DbgPrint("BKSETUP: Failed generating program key and mutex name./n"); Status = ERROR_NOT_ENOUGH_MEMORY; break; } // Checking if the application already running if (!(hMutex = CreateMutex(NULL, TRUE, MutexName)) || ((Status = GetLastError()) == ERROR_ALREADY_EXISTS)) { DbgPrint("BKSETUP: An other copy of the program already running./n"); Status = ERROR_SERVICE_ALREADY_RUNNING; break; } // Checking if we were already installed if (RegOpenKey(HKEY_LOCAL_MACHINE, KeyName, &hKey) == NO_ERROR) { RegCloseKey(hKey); DbgPrint("BKSETUP: Already installed./n"); Status = ERROR_ALREADY_EXISTS; break; } OsVersion = GetVersion(); VersionHi = LOBYTE(LOWORD(OsVersion)); VersionLo = HIBYTE(LOWORD(OsVersion)); // Checking if current OS supported if ((VersionHi == 5 && VersionLo == 0) || VersionHi < 5 || VersionHi > 6) { Status = ERROR_OLD_WIN_VERSION; DbgPrint("BKSETUP: OS not supported./n"); break; } // Running as separate executable if (VersionHi == 6) { // For Vista and higher: // Checking for UAC elevated token HANDLE hToken; ULONG bSize; Elevated = FALSE; if (OpenProcessToken(GetCurrentProcess(), READ_CONTROL | TOKEN_QUERY, &hToken)) { GetTokenInformation(hToken, 20, &Elevated, sizeof(BOOL), &bSize); CloseHandle(hToken); } } // if (VersionHi >= 6) if (!Elevated) { // Running with low integrity access token if (IsExe) { // Releasing program mutex CloseHandle(hMutex); hMutex = 0; // Requesting elevation RequestUac(); } Status = ERROR_ACCESS_DENIED; DbgPrint("BKSETUP: Not enough privileges to complete installation./n"); break; } // if (!Elevated) // Unpacking joined module depending on current OS architecture if (!GetJoinedData(g_CurrentModuleBase, &Payload, &PayloadSize, IsProcessWow64(g_CurrentProcessId), 0, TARGET_FLAG_DRV)) { Status = ERROR_FILE_NOT_FOUND; DbgPrint("BKSETUP: No joined payload found./n"); break; } // Unpacking joined initial loader if (!GetJoinedData(g_CurrentModuleBase, &BootLoader, &BootSize, FALSE, 0, TARGET_FLAG_BINARY))//.........这里部分代码省略.........
开发者ID:bacdor-factory,项目名称:Win64-Rovnix-VBR-Bootkit,代码行数:101,
示例5: About//.........这里部分代码省略......... (LPVOID)&lpVersion, (UINT *)&uVersionLen); // Notice order of version and string... _snprintf_s(szResult, 256, _TRUNCATE, "About %s", lpVersion); // set dialog caption SetWindowText (hDlg, szResult); // Walk through the dialog items that we want to replace: for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++) { GetDlgItemText(hDlg, i, szResult, sizeof(szResult)); _snprintf_s(szGetName, 256, _TRUNCATE, "%s%s", GetStringRes(IDS_VER_INFO_LANG), szResult); uVersionLen = 0; lpVersion = NULL; bRetCode = VerQueryValue((LPVOID)lpstrVffInfo, (LPSTR)szGetName, (LPVOID)&lpVersion, (UINT *)&uVersionLen); if ( bRetCode && uVersionLen && lpVersion) { // Replace dialog item text with version info strncpy_s(szResult, 256, lpVersion, _TRUNCATE); SetDlgItemText(hDlg, i, szResult); } else { dwResult = GetLastError(); _snprintf_s(szResult, 256, _TRUNCATE, GetStringRes(IDS_VERSION_ERROR), dwResult); SetDlgItemText (hDlg, i, szResult); } SendMessage (GetDlgItem (hDlg, i), WM_SETFONT, (UINT_PTR)((i==DLG_VERLAST)?hFinePrint:hfontDlg), TRUE); } // for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++) GlobalUnlock(hMem); GlobalFree(hMem); } else { // No version information available. } // if (dwVerInfoSize) SendMessage (GetDlgItem (hDlg, IDC_LABEL), WM_SETFONT, (WPARAM)hfontDlg,(LPARAM)TRUE); // We are using GetVersion rather then GetVersionEx // because earlier versions of Windows NT and Win32s // didn't include GetVersionEx: dwVersion = GetVersion(); if (dwVersion < 0x80000000) { // Windows NT _snprintf_s(szVersion, 40, _TRUNCATE, "Microsoft Windows NT %u.%u (Build: %u)", (DWORD)(LOBYTE(LOWORD(dwVersion))), (DWORD)(HIBYTE(LOWORD(dwVersion))), (DWORD)(HIWORD(dwVersion)) ); } else if (LOBYTE(LOWORD(dwVersion))<4) { // Win32s _snprintf_s(szVersion, 40, _TRUNCATE, "Microsoft Win32s %u.%u (Build: %u)", (DWORD)(LOBYTE(LOWORD(dwVersion))), (DWORD)(HIBYTE(LOWORD(dwVersion))), (DWORD)(HIWORD(dwVersion) & ~0x8000) ); } else { // Windows 95 _snprintf_s(szVersion, 40, _TRUNCATE, "Microsoft Windows 95 %u.%u", (DWORD)(LOBYTE(LOWORD(dwVersion))), (DWORD)(HIBYTE(LOWORD(dwVersion))) ); } SetWindowText (GetDlgItem(hDlg, IDC_OSVERSION), szVersion); // now display the finished product ShowWindow (hDlg, SW_SHOW); return (TRUE); case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, TRUE); DeleteObject (hfontDlg); DeleteObject (hFinePrint); return (TRUE); } break; } return FALSE;}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:101,
示例6: OPENSSL_showfatalvoid OPENSSL_showfatal (const char *fmta,...){ va_list ap; TCHAR buf[256]; const TCHAR *fmt;#ifdef STD_ERROR_HANDLE /* what a dirty trick! */ HANDLE h; if ((h=GetStdHandle(STD_ERROR_HANDLE)) != NULL && GetFileType(h)!=FILE_TYPE_UNKNOWN) { /* must be console application */ va_start (ap,fmta); vfprintf (stderr,fmta,ap); va_end (ap); return; }#endif if (sizeof(TCHAR)==sizeof(char)) fmt=(const TCHAR *)fmta; else do { int keepgoing; size_t len_0=strlen(fmta)+1,i; WCHAR *fmtw; fmtw = (WCHAR *)alloca(len_0*sizeof(WCHAR)); if (fmtw == NULL) { fmt=(const TCHAR *)L"no stack?"; break; }#ifndef OPENSSL_NO_MULTIBYTE if (!MultiByteToWideChar(CP_ACP,0,fmta,len_0,fmtw,len_0))#endif for (i=0; i<len_0; i++) fmtw[i]=(WCHAR)fmta[i]; for (i=0; i<len_0; i++) { if (fmtw[i]==L'%') do { keepgoing=0; switch (fmtw[i+1]) { case L'0': case L'1': case L'2': case L'3': case L'4': case L'5': case L'6': case L'7': case L'8': case L'9': case L'.': case L'*': case L'-': i++; keepgoing=1; break; case L's': fmtw[i+1]=L'S'; break; case L'S': fmtw[i+1]=L's'; break; case L'c': fmtw[i+1]=L'C'; break; case L'C': fmtw[i+1]=L'c'; break; } } while (keepgoing); } fmt = (const TCHAR *)fmtw; } while (0); va_start (ap,fmta); _vsntprintf (buf,sizeof(buf)/sizeof(TCHAR)-1,fmt,ap); buf [sizeof(buf)/sizeof(TCHAR)-1] = _T('/0'); va_end (ap);#if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333 /* this -------------v--- guards NT-specific calls */ if (GetVersion() < 0x80000000 && OPENSSL_isservice() > 0) { HANDLE h = RegisterEventSource(0,_T("OPENSSL")); const TCHAR *pmsg=buf; ReportEvent(h,EVENTLOG_ERROR_TYPE,0,0,0,1,0,&pmsg,0); DeregisterEventSource(h); } else#endif MessageBox (NULL,buf,_T("OpenSSL: FATAL"),MB_OK|MB_ICONSTOP);}
开发者ID:zhulianhai,项目名称:CryptoWrapperForCCode,代码行数:91,
示例7: service_admin_util_get_unameAXIS2_EXTERN axis2_char_t* AXIS2_CALLservice_admin_util_get_uname(axutil_env_t *env,char mode){ char *unameval; char tmp_uname[256];#ifdef WIN32 DWORD dwBuild=0; DWORD dwVersion = GetVersion(); DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion))); DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1; TCHAR ComputerName[MAX_COMPUTERNAME_LENGTH + 1]; SYSTEM_INFO SysInfo; GetComputerName(ComputerName, &dwSize); GetSystemInfo(&SysInfo); if (mode == 's') { if (dwVersion < 0x80000000) { unameval = "Windows NT"; } else { unameval = "Windows 9x"; } } else if (mode == 'r') { snprintf(tmp_uname, sizeof(tmp_uname), "%d.%d", dwWindowsMajorVersion, dwWindowsMinorVersion); unameval = tmp_uname; } else if (mode == 'n') { unameval = ComputerName; } else if (mode == 'v') { dwBuild = (DWORD)(HIWORD(dwVersion)); snprintf(tmp_uname, sizeof(tmp_uname), "build %d", dwBuild); unameval = tmp_uname; } else if (mode == 'm') { switch (SysInfo.wProcessorArchitecture) { case PROCESSOR_ARCHITECTURE_INTEL : snprintf(tmp_uname, sizeof(tmp_uname), "i%d", SysInfo.dwProcessorType); unameval = tmp_uname; break; case PROCESSOR_ARCHITECTURE_MIPS : snprintf(tmp_uname, sizeof(tmp_uname), "MIPS R%d000", SysInfo.wProcessorLevel); unameval = tmp_uname; break; case PROCESSOR_ARCHITECTURE_ALPHA : snprintf(tmp_uname, sizeof(tmp_uname), "Alpha %d", SysInfo.wProcessorLevel); unameval = tmp_uname; break; case PROCESSOR_ARCHITECTURE_PPC : snprintf(tmp_uname, sizeof(tmp_uname), "PPC 6%02d", SysInfo.wProcessorLevel); unameval = tmp_uname; break; case PROCESSOR_ARCHITECTURE_IA64 : unameval = "IA64"; break;#if defined(PROCESSOR_ARCHITECTURE_IA32_ON_WIN64) case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 : unameval = "IA32"; break;#endif#if defined(PROCESSOR_ARCHITECTURE_AMD64) case PROCESSOR_ARCHITECTURE_AMD64 : unameval = "AMD64"; break;#endif case PROCESSOR_ARCHITECTURE_UNKNOWN : default : unameval = "Unknown"; break; } } else { /* assume mode == 'a' */ /* Get build numbers for Windows NT or Win95 */ if (dwVersion < 0x80000000){ dwBuild = (DWORD)(HIWORD(dwVersion)); snprintf(tmp_uname, sizeof(tmp_uname), "%s %d.%d build %d", "Windows NT", dwWindowsMajorVersion, dwWindowsMinorVersion, dwBuild); } else { snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %d.%d", "Windows 9x", dwWindowsMajorVersion, dwWindowsMinorVersion); } unameval = tmp_uname; }#else#ifdef HAVE_SYS_UTSNAME_H struct utsname buf; if (uname((struct utsname *)&buf) == -1) { unameval = "Linux"; } else { if (mode == 's') { unameval = buf.sysname; } else if (mode == 'r') { unameval = buf.release; } else if (mode == 'n') { unameval = buf.nodename; } else if (mode == 'v') { unameval = buf.version; } else if (mode == 'm') { unameval = buf.machine; } else { /* assume mode == 'a' */ snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %s %s %s",//.........这里部分代码省略.........
开发者ID:AdrianRys,项目名称:wsf,代码行数:101,
示例8: Win32_GetVersionstatic intWin32_GetVersion(Jim_Interp *interp, int objc, Jim_Obj * const *objv){ Jim_SetResult(interp, Jim_NewIntObj(interp, GetVersion())); return JIM_OK;}
开发者ID:evanhunter,项目名称:jimtcl,代码行数:6,
示例9: test_GetRandomRgnstatic void test_GetRandomRgn(void){ HWND hwnd = CreateWindowExA(0,"BUTTON","test",WS_VISIBLE|WS_POPUP,0,0,100,100,GetDesktopWindow(),0,0,0); HDC hdc; HRGN hrgn = CreateRectRgn(0, 0, 0, 0); int ret; RECT rc, rc2; RECT ret_rc, window_rc; ok( hwnd != 0, "CreateWindow failed/n" ); SetRect(&window_rc, 400, 300, 500, 400); SetWindowPos(hwnd, HWND_TOPMOST, window_rc.left, window_rc.top, window_rc.right - window_rc.left, window_rc.bottom - window_rc.top, 0 ); hdc = GetDC(hwnd); ret = GetRandomRgn(hdc, hrgn, 1); ok(ret == 0, "GetRandomRgn rets %d/n", ret); ret = GetRandomRgn(hdc, hrgn, 2); ok(ret == 0, "GetRandomRgn rets %d/n", ret); ret = GetRandomRgn(hdc, hrgn, 3); ok(ret == 0, "GetRandomRgn rets %d/n", ret); /* Set a clip region */ SetRect(&rc, 20, 20, 80, 80); IntersectClipRect(hdc, rc.left, rc.top, rc.right, rc.bottom); ret = GetRandomRgn(hdc, hrgn, 1); ok(ret != 0, "GetRandomRgn rets %d/n", ret); GetRgnBox(hrgn, &ret_rc); ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %s/n", wine_dbgstr_rect(&ret_rc)); ret = GetRandomRgn(hdc, hrgn, 2); ok(ret == 0, "GetRandomRgn rets %d/n", ret); ret = GetRandomRgn(hdc, hrgn, 3); ok(ret != 0, "GetRandomRgn rets %d/n", ret); GetRgnBox(hrgn, &ret_rc); ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %s/n", wine_dbgstr_rect(&ret_rc)); /* Move the clip to the meta and clear the clip */ SetMetaRgn(hdc); ret = GetRandomRgn(hdc, hrgn, 1); ok(ret == 0, "GetRandomRgn rets %d/n", ret); ret = GetRandomRgn(hdc, hrgn, 2); ok(ret != 0, "GetRandomRgn rets %d/n", ret); GetRgnBox(hrgn, &ret_rc); ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %s/n", wine_dbgstr_rect(&ret_rc)); ret = GetRandomRgn(hdc, hrgn, 3); ok(ret != 0, "GetRandomRgn rets %d/n", ret); GetRgnBox(hrgn, &ret_rc); ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %s/n", wine_dbgstr_rect(&ret_rc)); /* Set a new clip (still got the meta) */ SetRect(&rc2, 10, 30, 70, 90); IntersectClipRect(hdc, rc2.left, rc2.top, rc2.right, rc2.bottom); ret = GetRandomRgn(hdc, hrgn, 1); ok(ret != 0, "GetRandomRgn rets %d/n", ret); GetRgnBox(hrgn, &ret_rc); ok(EqualRect(&rc2, &ret_rc), "GetRandomRgn %s/n", wine_dbgstr_rect(&ret_rc)); ret = GetRandomRgn(hdc, hrgn, 2); ok(ret != 0, "GetRandomRgn rets %d/n", ret); GetRgnBox(hrgn, &ret_rc); ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %s/n", wine_dbgstr_rect(&ret_rc)); IntersectRect(&rc2, &rc, &rc2); ret = GetRandomRgn(hdc, hrgn, 3); ok(ret != 0, "GetRandomRgn rets %d/n", ret); GetRgnBox(hrgn, &ret_rc); ok(EqualRect(&rc2, &ret_rc), "GetRandomRgn %s/n", wine_dbgstr_rect(&ret_rc)); ret = GetRandomRgn(hdc, hrgn, SYSRGN); ok(ret != 0, "GetRandomRgn rets %d/n", ret); GetRgnBox(hrgn, &ret_rc); if(GetVersion() & 0x80000000) OffsetRect(&window_rc, -window_rc.left, -window_rc.top); /* the window may be partially obscured so the region may be smaller */ IntersectRect( &window_rc, &ret_rc, &ret_rc ); ok(EqualRect(&window_rc, &ret_rc), "GetRandomRgn %s/n", wine_dbgstr_rect(&ret_rc)); DeleteObject(hrgn); ReleaseDC(hwnd, hdc); DestroyWindow(hwnd);}
开发者ID:wine-mirror,项目名称:wine,代码行数:90,
示例10: TestSuite_PrintJsonHeaderstatic voidTestSuite_PrintJsonHeader (TestSuite *suite, /* IN */ FILE *stream) /* IN */{#ifdef _WIN32# define INFO_BUFFER_SIZE 32767 SYSTEM_INFO si; DWORD version = 0; DWORD major_version = 0; DWORD minor_version = 0; DWORD build = 0; GetSystemInfo(&si); version = GetVersion(); major_version = (DWORD)(LOBYTE(LOWORD(version))); minor_version = (DWORD)(HIBYTE(LOWORD(version))); if (version < 0x80000000) { build = (DWORD)(HIWORD(version)); } fprintf (stream, "{/n" " /"host/": {/n" " /"sysname/": /"Windows/",/n" " /"release/": /"%ld.%ld (%ld)/",/n" " /"machine/": /"%ld/",/n" " /"memory/": {/n" " /"pagesize/": %ld,/n" " /"npages/": %d/n" " }/n" " },/n" " /"options/": {/n" " /"parallel/": /"%s/",/n" " /"fork/": /"%s/"/n" " },/n" " /"tests/": [/n", major_version, minor_version, build, si.dwProcessorType, si.dwPageSize, 0, (suite->flags & TEST_NOTHREADS) ? "false" : "true", (suite->flags & TEST_NOFORK) ? "false" : "true");#else struct utsname u; uint64_t pagesize; uint64_t npages = 0; ASSERT (suite); if (uname (&u) == -1) { perror ("uname()"); return; } pagesize = sysconf (_SC_PAGE_SIZE);# if defined(_SC_PHYS_PAGES) npages = sysconf (_SC_PHYS_PAGES);# endif fprintf (stream, "{/n" " /"host/": {/n" " /"sysname/": /"%s/",/n" " /"release/": /"%s/",/n" " /"machine/": /"%s/",/n" " /"memory/": {/n" " /"pagesize/": %"PRIu64",/n" " /"npages/": %"PRIu64"/n" " }/n" " },/n" " /"options/": {/n" " /"parallel/": /"%s/",/n" " /"fork/": /"%s/"/n" " },/n" " /"tests/": [/n", u.sysname, u.release, u.machine, pagesize, npages, (suite->flags & TEST_NOTHREADS) ? "false" : "true", (suite->flags & TEST_NOFORK) ? "false" : "true");#endif fflush (stream);}
开发者ID:Convey-Compliance,项目名称:libbson,代码行数:90,
示例11: MBInitstatic void MBInit( void )/************************/{#if defined( __NT__ ) && !defined( __UNIX__ ) int countRange, countVal; CPINFO cpInfo; BOOL rc;#elif defined __OS2__ || defined __OS2_PM__ int countRange, countVal; COUNTRYCODE countryInfo; CHAR leadBytes[12]; #ifdef _M_I86 USHORT rc; #else APIRET rc; #endif#elif defined( __WINDOWS__ ) || defined( __UNIX__ ) int countVal; DWORD version;#endif memset( __CharLenTable, 1, sizeof( __CharLenTable ) ); /* zero table to start */ #if defined( __NT__) && !defined( __UNIX__ ) /*** Initialize the __CharLenTable values ***/ rc = GetCPInfo( CP_OEMCP, &cpInfo ); /* get code page info */ if( rc == FALSE ) return; for( countRange=0; !(cpInfo.LeadByte[countRange]==0x00 && cpInfo.LeadByte[countRange+1]==0x00); countRange+=2 ) { for( countVal=cpInfo.LeadByte[countRange]; countVal<=cpInfo.LeadByte[countRange+1]; countVal++) { __CharLenTable[countVal] = 2; IsDBCS = TRUE; } } #elif defined __OS2__ || defined __OS2_PM__ /*** Initialize the __CharLenTable values ***/ countryInfo.country = 0; /* default country */ countryInfo.codepage = 0; /* specified code page */ #ifdef _M_I86 rc = DosGetDBCSEv( 12, &countryInfo, leadBytes ); #else rc = DosQueryDBCSEnv( 12, &countryInfo, leadBytes ); #endif if( rc != 0 ) return; for( countRange=0; !(leadBytes[countRange]==0x00 && leadBytes[countRange+1]==0x00); countRange+=2 ) { for( countVal=leadBytes[countRange]; countVal<=leadBytes[countRange+1]; countVal++) { __CharLenTable[countVal] = 2; IsDBCS = TRUE; } } #elif defined( __WINDOWS__ ) || defined( __UNIX__ ) /*** Initialize the __CharLenTable values ***/ version = GetVersion(); if( LOWORD(version) < ((10<<8)+3) ) return; /* 3.1+ needed */ for( countVal=0; countVal<256; countVal++ ) { if( IsDBCSLeadByte( (BYTE)countVal ) ) { __CharLenTable[countVal] = 2; IsDBCS = TRUE; } } #endif}
开发者ID:jossk,项目名称:open-watcom-v2,代码行数:66,
示例12: GetVersion const wchar_t* GameObjectComponent::GetVersionString() { return GetVersion().AsWString().c_str(); }
开发者ID:lythm,项目名称:orb3d,代码行数:4,
示例13: HandleUnknownExceptionLONG WINAPI HandleUnknownException(struct _EXCEPTION_POINTERS *ExceptionInfo){ WCHAR registerInfo[220]; WCHAR filepath[MAX_PATH] = {0}; WCHAR file[MAX_PATH] = {0}; WCHAR message[MAX_PATH + 200 + _countof(registerInfo)]; WCHAR osInfo[100]; DWORD_PTR baseAddress = 0; DWORD_PTR address = (DWORD_PTR)ExceptionInfo->ExceptionRecord->ExceptionAddress; wcscpy_s(filepath, L"unknown"); wcscpy_s(file, L"unknown"); if (GetMappedFileNameW(GetCurrentProcess(), (LPVOID)address, filepath, _countof(filepath)) > 0) { WCHAR *temp = wcsrchr(filepath, '//'); if (temp) { temp++; wcscpy_s(file, temp); } } swprintf_s(osInfo, _countof(osInfo), TEXT("Exception! Please report it! OS: %X"), GetVersion()); DWORD_PTR moduleBase = (DWORD_PTR)GetModuleHandleW(file); swprintf_s(message, _countof(message), TEXT("ExceptionCode %08X/r/nExceptionFlags %08X/r/nNumberParameters %08X/r/nExceptionAddress VA ")TEXT(PRINTF_DWORD_PTR_FULL_S)TEXT(" - Base ")TEXT(PRINTF_DWORD_PTR_FULL_S)TEXT("/r/nExceptionAddress module %s/r/n/r/n"), ExceptionInfo->ExceptionRecord->ExceptionCode, ExceptionInfo->ExceptionRecord->ExceptionFlags, ExceptionInfo->ExceptionRecord->NumberParameters, address, moduleBase, file);#ifdef _WIN64 swprintf_s(registerInfo, _countof(registerInfo),TEXT("rax=0x%p, rbx=0x%p, rdx=0x%p, rcx=0x%p, rsi=0x%p, rdi=0x%p, rbp=0x%p, rsp=0x%p, rip=0x%p"), ExceptionInfo->ContextRecord->Rax, ExceptionInfo->ContextRecord->Rbx, ExceptionInfo->ContextRecord->Rdx, ExceptionInfo->ContextRecord->Rcx, ExceptionInfo->ContextRecord->Rsi, ExceptionInfo->ContextRecord->Rdi, ExceptionInfo->ContextRecord->Rbp, ExceptionInfo->ContextRecord->Rsp, ExceptionInfo->ContextRecord->Rip );#else swprintf_s(registerInfo, _countof(registerInfo),TEXT("eax=0x%p, ebx=0x%p, edx=0x%p, ecx=0x%p, esi=0x%p, edi=0x%p, ebp=0x%p, esp=0x%p, eip=0x%p"), ExceptionInfo->ContextRecord->Eax, ExceptionInfo->ContextRecord->Ebx, ExceptionInfo->ContextRecord->Edx, ExceptionInfo->ContextRecord->Ecx, ExceptionInfo->ContextRecord->Esi, ExceptionInfo->ContextRecord->Edi, ExceptionInfo->ContextRecord->Ebp, ExceptionInfo->ContextRecord->Esp, ExceptionInfo->ContextRecord->Eip );#endif wcscat_s(message, _countof(message), registerInfo); MessageBox(0, message, osInfo, MB_ICONERROR); return EXCEPTION_CONTINUE_SEARCH;}
开发者ID:AmesianX,项目名称:Scylla,代码行数:67,
|