本文整理汇总了C++中GetWindowsVersion函数的典型用法代码示例。如果您正苦于以下问题:C++ GetWindowsVersion函数的具体用法?C++ GetWindowsVersion怎么用?C++ GetWindowsVersion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetWindowsVersion函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WinMain
/*--------------------------------------------------------------------------*/
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int iCmdShow)
{
int iExitCode = 0;
HINSTANCE hinstLib = NULL;
BOOL fFreeResult = FALSE, fRunTimeLinkSuccess = FALSE;
if (GetWindowsVersion() == OS_ERROR )
{
MessageBox(NULL, TEXT(MSG_DETECT_UNKNOW), TEXT(MSG_WARNING), MB_ICONWARNING);
return -1;
}
if (GetWindowsVersion() < OS_WIN32_WINDOWS_XP )
{
MessageBox(NULL, TEXT(MSG_DETECT_XP_OR_MORE), TEXT(MSG_WARNING), MB_ICONWARNING);
return -1;
}
/* http://msdn.microsoft.com/en-us/library/ms724482(VS.85).aspx */
if (!IsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE))
{
MessageBox(NULL, TEXT(MSG_DETECT_SSE_OR_MORE), TEXT(MSG_WARNING), MB_ICONWARNING);
return -1;
}
hinstLib = LoadLibrary(TEXT(SCILAB_LIBRARY));
if (hinstLib != NULL)
{
MYPROC1 Windows_Main = NULL;
/* launch main */
Windows_Main = (MYPROC1) GetProcAddress(hinstLib, MAIN_FUNCTION);
if (NULL != Windows_Main)
{
#ifndef _DEBUG
/* catch system errors msgbox (release mode only) */
/* http://msdn.microsoft.com/en-us/library/ms680621(VS.85).aspx */
UINT LastErrorMode = SetErrorMode( SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT | SEM_NOGPFAULTERRORBOX );
_try
{
#endif
fRunTimeLinkSuccess = TRUE;
/* launch main */
iExitCode = (Windows_Main)(hInstance, hPrevInstance, szCmdLine, iCmdShow);
#ifndef _DEBUG
}
_except (EXCEPTION_EXECUTE_HANDLER)
{
}
#endif
}
示例2: DriverEntry
//#######################################################################################
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@ D R I V E R E N T R Y P O I N T @@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//#######################################################################################
NTSTATUS
DriverEntry(IN PDRIVER_OBJECT pDriverObj, IN PUNICODE_STRING pRegistryString)
{
NTSTATUS status = STATUS_UNSUCCESSFUL;
//记录自身驱动的信息
g_MyDriverObject = pDriverObj;
g_MyDriverBase = pDriverObj->DriverStart;
g_MyDriverSize = pDriverObj->DriverSize;
//Initialize Windows Version
GetWindowsVersion();
if (WinVersion == WINDOWS_VERSION_7_7000 ||
WinVersion == WINDOWS_VERSION_7_7600_UP)
{
bWin7 = TRUE;
}
else if (WinVersion == WINDOWS_VERSION_XP)
{
bWin7 = FALSE;
}
else
{
//既不是win7也不是winxp
goto DriverRet;
}
//测试
//__asm int 3;
status = ReloadNtos(g_MyDriverObject);
if (status != STATUS_SUCCESS)
{
goto DriverRet;
}
DriverRet:
return status;
}
示例3: WriteSystemSpecToLog
//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
void WriteSystemSpecToLog(Log* log) {
log->WriteLineStrongly("システム情報");
log->BeginTable();
log->Write("CPU名");
log->ChangeColumn();
log->Write(GetCPUName().c_str());
log->ChangeRow();
log->Write("OS情報");
log->ChangeColumn();
#if defined(_WIN32)
log->Write("OS: Windows\n");
log->Write(GetWindowsVersion().c_str());
#else
log->Write("Unavailable");
#endif
log->ChangeRow();
log->Write("メモリ情報");
log->ChangeColumn();
log->Write(GetMemoryInfo().c_str());
log->EndTable();
}
示例4: switch
CStdString SystemFolderInfo::GetCommonStartMenu()
{
CStdString sPath;
switch (GetWindowsVersion())
{
case WINDOWS_95:
case WINDOWS_ME:
case WINDOWS_98:
{
if (HasWin98UserGotProfile())
sPath = GetProfilePath();
else
sPath = GetWindowsPath();
sPath += _T("\\Local Settings\\Start Menu");
}
break;
case WINDOWS_NT:
case WINDOWS_2K:
case WINDOWS_XP:
case WINDOWS_2003SERVER:
default:
sPath = GetFolderPath(CSIDL_COMMON_STARTMENU, NULL);
break;
}
ValidatePath(sPath, CSIDL_COMMON_STARTMENU);
return sPath;
}
示例5: TEST_F
TEST_F(ShellTest, CreateShortcut) {
// FIXME i#12: Re-enable on XP when passes.
if (GetWindowsVersion() < WIN_VISTA) {
printf("WARNING: Disabling ShellTest.* on Pre-Vista, see i#12.\n");
return;
}
HRESULT hr;
IShellLinkW *shell;
IPersistFile *persist = NULL;
// Create a shortcut.
hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
IID_IShellLinkW, (LPVOID*)(&shell));
EXPECT_TRUE(SUCCEEDED(hr));
hr = shell->QueryInterface(IID_IPersistFile, (void**)(&persist));
EXPECT_TRUE(SUCCEEDED(hr));
hr = shell->SetPath(file_path_.c_str());
EXPECT_TRUE(SUCCEEDED(hr));
hr = shell->SetDescription(kLinkDescription);
EXPECT_TRUE(SUCCEEDED(hr));
hr = persist->Save(link_path_.c_str(), TRUE);
EXPECT_TRUE(SUCCEEDED(hr));
if (persist)
persist->Release();
if (shell)
shell->Release();
}
示例6: ReLoadKbdclassFree
NTSTATUS ReLoadKbdclassFree()
{
WIN_VER_DETAIL WinVer;
WinVer = GetWindowsVersion();
if (WinVer == WINDOWS_VERSION_2K3_SP1_SP2)
return STATUS_UNSUCCESSFUL;
if (MmIsAddressValidEx(PKbdclassDriverObjectBakup))
{
if (ulReal_KBDCLASS_IRP_MJ_CREATE &&
ulReal_KBDCLASS_IRP_MJ_CLOSE &&
ulReal_KBDCLASS_IRP_MJ_READ &&
ulReal_KBDCLASS_IRP_MJ_FLUSH_BUFFERS &&
ulReal_KBDCLASS_IRP_MJ_DEVICE_CONTROL &&
ulReal_KBDCLASS_IRP_MJ_INTERNAL_DEVICE_CONTROL &&
ulReal_KBDCLASS_IRP_MJ_CLEANUP &&
ulReal_KBDCLASS_IRP_MJ_POWER &&
ulReal_KBDCLASS_IRP_MJ_SYSTEM_CONTROL &&
ulReal_KBDCLASS_IRP_MJ_PNP_POWER)
{
PKbdclassDriverObjectBakup->MajorFunction[IRP_MJ_CREATE] = ulReal_KBDCLASS_IRP_MJ_CREATE;
PKbdclassDriverObjectBakup->MajorFunction[IRP_MJ_CLOSE] = ulReal_KBDCLASS_IRP_MJ_CLOSE;
PKbdclassDriverObjectBakup->MajorFunction[IRP_MJ_READ] = ulReal_KBDCLASS_IRP_MJ_READ;
PKbdclassDriverObjectBakup->MajorFunction[IRP_MJ_FLUSH_BUFFERS] = ulReal_KBDCLASS_IRP_MJ_FLUSH_BUFFERS;
PKbdclassDriverObjectBakup->MajorFunction[IRP_MJ_DEVICE_CONTROL] = ulReal_KBDCLASS_IRP_MJ_DEVICE_CONTROL;
PKbdclassDriverObjectBakup->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = ulReal_KBDCLASS_IRP_MJ_INTERNAL_DEVICE_CONTROL;
PKbdclassDriverObjectBakup->MajorFunction[IRP_MJ_CLEANUP] = ulReal_KBDCLASS_IRP_MJ_CLEANUP;
PKbdclassDriverObjectBakup->MajorFunction[IRP_MJ_POWER] = ulReal_KBDCLASS_IRP_MJ_POWER;
PKbdclassDriverObjectBakup->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = ulReal_KBDCLASS_IRP_MJ_SYSTEM_CONTROL;
PKbdclassDriverObjectBakup->MajorFunction[IRP_MJ_PNP_POWER] = ulReal_KBDCLASS_IRP_MJ_PNP_POWER;
}
}
return STATUS_SUCCESS;
}
示例7: SetTcpHook
VOID SetTcpHook(ULONG ulNumber,ULONG ulRealDispatch)
{
PDRIVER_OBJECT PTcpDriverObject = NULL;
ULONG ulReloadDispatch;
if (MmIsAddressValidEx(PTcpDriverObjectBakup))
{
PTcpDriverObject = PTcpDriverObjectBakup;
PTcpDriverObject->MajorFunction[ulNumber] = ulRealDispatch; //恢复 fsd hook
if (GetWindowsVersion() == WINDOWS_VERSION_XP ||
GetWindowsVersion() == WINDOWS_VERSION_2K3_SP1_SP2)
{
ulReloadDispatch = ulRealDispatch - ulTcpipModuleBase + ulReLoadTcpipModuleBase;
//恢复 fsd inline hook
if (GetFunctionCodeSize(ulRealDispatch) != GetFunctionCodeSize(ulReloadDispatch))
{
return;
}
if (memcmp(ulRealDispatch,ulReloadDispatch,GetFunctionCodeSize(ulRealDispatch)) == NULL)
{
return;
}
__asm
{
cli
push eax
mov eax,cr0
and eax,not 0x10000
mov cr0,eax
pop eax
}
memcpy(ulRealDispatch,ulReloadDispatch,GetFunctionCodeSize(ulRealDispatch));
__asm
{
push eax
mov eax,cr0
or eax,0x10000
mov cr0,eax
pop eax
sti
}
}
}
示例8: IsWindowsXPorHigher
bool ActivationContextLoader::IsWindowsXPorHigher()
{
if (GetWindowsVersion() > WINDOWS_2K)
{
return true;
}
return false;
}
示例9: __declspec
extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP(&pluginInfo);
GetWindowsVersion();
OpenKeyboardDevice();
hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
return 0;
}
示例10: LAST_ERROR_NUMBER
//==============================================================================
// вспомогательные функции для работы с модулем
//==============================================================================
BOOL WINAPI TLUSBBASE::OpenLDeviceByID(WORD VirtualSlot, DWORD DeviceID)
{
char DeviceName[18];
WORD i;
DWORD WindowsVersion;
// сбросим номер последней ошибки
LAST_ERROR_NUMBER(0x0);
// виртуальный слот доступен?
if(hDevice != INVALID_HANDLE_VALUE) { CloseHandle(hDevice); hDevice = INVALID_HANDLE_VALUE; }
// определимся с версией используемой Windows
WindowsVersion = GetWindowsVersion();
if((WindowsVersion == UNKNOWN_WINDOWS_VERSION) ||
(WindowsVersion == WINDOWS_32S) || (WindowsVersion == WINDOWS_95) ||
(WindowsVersion == WINDOWS_NT)) { LAST_ERROR_NUMBER(1); return FALSE; }
// формируем название драйвера USB
wsprintf(DeviceName, "\\\\.\\LDev%d", VirtualSlot);
// попробуем открыть идентификатор для модуля
hDevice = CreateFile(DeviceName, GENERIC_READ|GENERIC_WRITE, 0x0, NULL,
OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
// проверим: получилось ли открыть устройство?
if(hDevice == INVALID_HANDLE_VALUE) { LAST_ERROR_NUMBER(2); return FALSE; }
// попробуем получить первичную информацию об открытом устройсве
if(!GetDeviceInitialInfo()) { LAST_ERROR_NUMBER(11); CloseLDevice(); return FALSE; }
// если требуется пройтись по всем ID, то выполним это
else if(DeviceID == ENUM_ALL_USB_DEVICE_ID)
{
for(i = 0x0; i < SUPPORTED_USB_DEVICES_QUANTITY; i++)
if(DeviceInitialInfo.DeviceID == DEVICES_ID_ARRAY[i]) break;
if(i == SUPPORTED_USB_DEVICES_QUANTITY) { LAST_ERROR_NUMBER(12); return FALSE; }
}
// проверим полученное ID устройства с требуемым
else if(DeviceInitialInfo.DeviceID != DeviceID)
{
if(DeviceID == E2010_ID)
{
if(DeviceInitialInfo.DeviceID != E2010B_ID) { LAST_ERROR_NUMBER(13); return FALSE; }
}
else { LAST_ERROR_NUMBER(13); return FALSE; }
}
// попробуем прочитать название модуля
if(!GetModuleName(ModuleName)) { LAST_ERROR_NUMBER(3); CloseLDevice(); return FALSE; }
// определим на какой скорости работает модуль
else if(!GetUsbSpeed(&UsbSpeed)) { LAST_ERROR_NUMBER(4); CloseLDevice(); return FALSE; }
// неправильно опредилась скорость работы модуля на шине USB
else if(UsbSpeed >= INVALID_USB_SPEED_LUSBAPI) { LAST_ERROR_NUMBER(5); CloseLDevice(); return FALSE; }
// все хорошо :)))))
else return TRUE;
}
示例11: __declspec
extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP(&pluginInfo);
mir_getCLI();
GetWindowsVersion();
OpenKeyboardDevice();
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreshutdown);
return 0;
}
示例12: WinMain
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
#ifndef NDEBUG
#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
flag |= _CRTDBG_LEAK_CHECK_DF;
_CrtSetDbgFlag(flag);
#endif
// Get the Version of Windows
windows_version = GetWindowsVersion();
if( windows_version < WINVER_VISTA )
{
MessageBox(NULL, TEXT("his program requires Windows Vista or newer."), TEXT("VulCan"), NULL);
return 1;
}
// Keep the instance handle of the application
g_hInst = hInstance;
// Creation and registration of the application class
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = 0;
wcex.lpfnWndProc = (WNDPROC) MainWndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = g_hInst;
wcex.hIcon = NULL;
wcex.hCursor = NULL;
wcex.hbrBackground = NULL;
wcex.lpszMenuName = NULL;
wcex.lpszClassName = g_szMainWnd;
wcex.hIconSm = NULL;
if( !RegisterClassEx(&wcex) )
return 1;
if( !CreateWindowEx(WS_EX_TOOLWINDOW, g_szMainWnd, g_szWindowName, 0, 0, 0, 0, 0, NULL, NULL, g_hInst, NULL) )
return 1;
// Main loop.
// Get and send messages for the application.
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
示例13: ParseVadTree
VOID ParseVadTree(BYTE* VadNode,PDLLINFO PDll)
{
DWORD LeftChildOfsset=0,RightChildOffset=0;
WIN_VER_DETAIL WinVer;
WinVer=GetWindowsVersion();
switch (WinVer)
{
case WINDOWS_VERSION_XP:
LeftChildOfsset=0x0c;
RightChildOffset=0x10;
break;
case WINDOWS_VERSION_2K3:
LeftChildOfsset=0x04;
RightChildOffset=0x08;
break;
case WINDOWS_VERSION_2K3_SP1_SP2:
LeftChildOfsset=0x04;
RightChildOffset=0x08;
break;
case WINDOWS_VERSION_VISTA_2008: //vista + 2008
LeftChildOfsset=0x04;
RightChildOffset=0x08;
break;
/*case 6002: //2008
LeftChildOfsset=0x04;
RightChildOffset=0x08;
break;
*/
case WINDOWS_VERSION_7_7000:
case WINDOWS_VERSION_7_7600_UP:
LeftChildOfsset=0x04;
RightChildOffset=0x08;
break;
}
if (LeftChildOfsset==0||RightChildOffset==0)
{
return;
}
if (MmIsAddressValidEx(VadNode))
{
if (MmIsAddressValidEx((VadNode+LeftChildOfsset)) &&
MmIsAddressValidEx((VadNode+RightChildOffset)))
{
ParseVadTree((BYTE*)(*(DWORD*)(VadNode+LeftChildOfsset)),PDll);
MyParseVadTreeRoutine(VadNode,PDll);
ParseVadTree((BYTE*)(*(DWORD*)(VadNode+RightChildOffset)),PDll);
}
}
}
示例14: _tmain
int _tmain(int argc, _TCHAR* argv[])
{
string verinfo = GetWindowsVersion() + "\r\n\r\n" + GetNetFrameworkVersion();
cout << endl << verinfo.c_str() << endl;
cout << SaveToFile(verinfo).c_str() << endl << endl << endl;
cout << "Нажмите любую клавишу...";
_getch();
return 0;
}
示例15: defined
std::string Sys::GetOSName() {
#if defined( EE_PLATFORM_POSIX )
struct utsname os;
if ( -1 != uname( &os ) ) {
return std::string( os.sysname ) + " " + std::string( os.release );
}
return "Unknown";
#elif EE_PLATFORM == EE_PLATFORM_WIN
return GetWindowsVersion();
#else
return "Unknown";
#endif
}