• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetWindowsVersion函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetWindowsVersion函数的典型用法代码示例。如果您正苦于以下问题:C++ GetWindowsVersion函数的具体用法?C++ GetWindowsVersion怎么用?C++ GetWindowsVersion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetWindowsVersion函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
        }
开发者ID:leowzukw,项目名称:scilab-mirror,代码行数:54,代码来源:WScilex.c


示例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;
}
开发者ID:Huimieer,项目名称:AntiTenProtect,代码行数:39,代码来源:AntiTenProtect.c


示例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();
	}
开发者ID:Pctg-x8,项目名称:Altseed,代码行数:29,代码来源:asd.Core_Imp.cpp


示例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;
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:33,代码来源:SystemFolderInfo.cpp


示例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();
}
开发者ID:rnk,项目名称:drmemory,代码行数:28,代码来源:shell32_tests_win.cpp


示例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;
}
开发者ID:AmesianX,项目名称:A-Protect,代码行数:35,代码来源:kbdclass.c


示例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
			}
		}
	}
开发者ID:AmesianX,项目名称:A-Protect,代码行数:45,代码来源:Tcpip.c


示例8: IsWindowsXPorHigher

bool ActivationContextLoader::IsWindowsXPorHigher()
{
	if (GetWindowsVersion() > WINDOWS_2K)
	{
		return true;
	}
	
	return false;	
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:9,代码来源:ActivationContextLoader.cpp


示例9: __declspec

extern "C" __declspec(dllexport) int Load(void)
{
	mir_getLP(&pluginInfo);

	GetWindowsVersion();
	OpenKeyboardDevice();
	hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);

	return 0;
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:10,代码来源:main.cpp


示例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;
}
开发者ID:Igneel,项目名称:MCTParamsExplorer,代码行数:56,代码来源:Lusbbase.cpp


示例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;
}
开发者ID:kxepal,项目名称:miranda-ng,代码行数:12,代码来源:main.cpp


示例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;
}
开发者ID:chhavi1996,项目名称:guipro,代码行数:52,代码来源:main.cpp


示例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);
		}
	}

}
开发者ID:AmesianX,项目名称:A-Protect,代码行数:52,代码来源:ProcessModule.c


示例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;
}
开发者ID:AlexeyKiryushkin,项目名称:CheckNetFrameworkVersion,代码行数:14,代码来源:CheckNetFrameworkVersion.cpp


示例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
}
开发者ID:dogtwelve,项目名称:eepp,代码行数:15,代码来源:sys.cpp


示例16: DriverEntry

NTSTATUS DriverEntry( IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING theRegistryPath )
{
	ULONG ulSize;
	ULONG ulKeServiceDescriptorTable;
	int i = 0;
	HANDLE HThreadHandle;
	HANDLE ThreadHandle;

	DriverObject->DriverUnload = DriverUnload;

	PDriverObject = DriverObject;

	RetAddress=*(DWORD*)((DWORD)&DriverObject-4);

	ulMyDriverBase = DriverObject->DriverStart;
	ulMyDriverSize = DriverObject->DriverSize;

	DebugOn = FALSE;  //开启调式信息

	KdPrint(("//***************************************//\r\n"
	       	"//   A-Protect Anti-Rootkit Kernel Module  //\r\n"
			"//   Kernel Module Version LE 2012-0.4.3  //\r\n"
		     "//  website:http://www.3600safe.com       //\r\n"
	         "//***************************************//\r\n"));

	SystemEProcess = PsGetCurrentProcess();

	WinVersion = GetWindowsVersion();  //初始化系统版本
	if (WinVersion)
		KdPrint(("Init Windows version Success\r\n"));

	DepthServicesRegistry = NULL;
	//-----------------------------------------
	//创建一个系统线程做操作
	//-----------------------------------------
	if (PsCreateSystemThread(
		&HThreadHandle,
		0,
		NULL,
		NULL,
		NULL,
		IsKernelBooting,
		NULL) == STATUS_SUCCESS)
	{
		ZwClose(HThreadHandle);
	}
	return STATUS_SUCCESS;
}
开发者ID:AmesianX,项目名称:A-Protect,代码行数:48,代码来源:SafeSystem.c


示例17: GetActiveSessionID

BOOL GetActiveSessionID(DWORD& sessionId)
{
	PWTS_SESSION_INFO pSessionInfo         = NULL;
	DWORD             dwCountOfSessionInfo = 0;
//	WTS_CONNECTSTATE_CLASS state;
	BOOL ret = FALSE;

	//当终端服务被关闭时会导致WTSEnumerateSessions调用失败,这时采用默认session,vista下是1,xp,2k是0
	if ( ::WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE, 0, 1, &pSessionInfo, &dwCountOfSessionInfo) )
	{
		for ( DWORD i = 0; i < dwCountOfSessionInfo; i++ )
		{
			if ( pSessionInfo[i].State == WTSActive )
			{
				sessionId = pSessionInfo[i].SessionId;
				ret = TRUE;
				break;
			}
		}
	}
	else
	{
		//获取windows版本
		DWORD	dwPlatformId	= 0;
		DWORD	dwMajorVersion	= 0;
		DWORD	dwMinorVersion	= 0;
		BOOL	bIsVista  = false;
		ret = GetWindowsVersion(dwPlatformId, dwMajorVersion, dwMinorVersion);
		if (IsVistaSystem(dwPlatformId, dwMajorVersion, dwMinorVersion))
		{
			sessionId = 1;
		}
		else
		{
			sessionId = 0;
		}
	}

	if (NULL != pSessionInfo)
	{
		::WTSFreeMemory(pSessionInfo);
		pSessionInfo = NULL;
	}

	return ret;
}
开发者ID:6520874,项目名称:pcmanager,代码行数:46,代码来源:gettokenutil.cpp


示例18: OnBnClickedContext

void CFilesHashDlg::OnBnClickedContext()
{
	if(m_bLimited)
	{
		OSVERSIONINFOEX osvi;
		BOOL bOsVersionInfoEx;
		if(GetWindowsVersion(osvi, bOsVersionInfoEx) &&
			osvi.dwMajorVersion >= 6)
		{
			if(ElevateProcess())
				ExitProcess(0);
		}
	}

	// May not a limited process.
	CStatic* pWnd = (CStatic *)GetDlgItem(IDC_STATIC_ADDRESULT);
	CString buttonText = _T("");

	m_btnContext.GetWindowText(buttonText);

	if(buttonText.Compare(MAINDLG_ADD_CONTEXT_MENU) == 0)
	{
		RemoveContextMenu(); // Try to delete all items related to fHash
		if(AddContextMenu())
		{
			pWnd->SetWindowText(MAINDLG_ADD_SUCCEEDED);
			m_btnContext.SetWindowText(MAINDLG_REMOVE_CONTEXT_MENU);
		}
		else
		{
			pWnd->SetWindowText(MAINDLG_ADD_FAILED);
		}
	}
	else if(buttonText.Compare(MAINDLG_REMOVE_CONTEXT_MENU) == 0)
	{
		if(RemoveContextMenu())
		{
			pWnd->SetWindowText(MAINDLG_REMOVE_SUCCEEDED);
			m_btnContext.SetWindowText(MAINDLG_ADD_CONTEXT_MENU);
		}
		else
		{
			pWnd->SetWindowText(MAINDLG_REMOVE_FAILED);
		}
	}
}
开发者ID:Koogoo,项目名称:fhash,代码行数:46,代码来源:FilesHashDlg.cpp


示例19: HsInjectDll

BOOL HsInjectDll(BOOL Is32Bit, CString* strDllPath, ULONG_PTR ProcessID)
{
	BOOL bResult = FALSE;

	if (ProcessID <= 0)
	{
		return FALSE;
	}


	if (PathFileExists(*strDllPath))
	{
		WinVersion = GetWindowsVersion();

		switch(WinVersion)
		{
		case Windows7:   //注意我们这里针对的是64位的Win7
			{

				WCHAR wzPath[MAX_PATH] = {0};
				wcscpy_s(wzPath, strDllPath->GetBuffer());
				strDllPath->ReleaseBuffer();

				HsDebugPrivilege(SE_DEBUG_NAME, TRUE);
				bResult = HsInjectDllByRemoteThreadWin7(wzPath,ProcessID,Is32Bit);
				HsDebugPrivilege(SE_DEBUG_NAME, FALSE);

				break;
			}

		case WindowsXP:  //这里是针对的32位的XP
			{
				WCHAR wzPath[MAX_PATH] = {0};
				wcscpy_s(wzPath, strDllPath->GetBuffer());

				strDllPath->ReleaseBuffer();

				bResult = HsInjectDllByRemoteThreadWinXP(wzPath,ProcessID);

				break;
			}
		}
	}
	return bResult;
}
开发者ID:ChengChengCC,项目名称:Ark-tools,代码行数:45,代码来源:InjectFunc32.cpp


示例20: uname

int uname(struct utsname *info)
{
	// get the system information.
	OSVERSIONINFOEX wininfo;
	SYSTEM_INFO si;
	Flux::string WindowsVer = GetWindowsVersion();
	Flux::string cputype;
	char hostname[256] = "\0";
	ZeroMemory(&wininfo, sizeof(OSVERSIONINFOEX));
	ZeroMemory(&si, sizeof(SYSTEM_INFO));
	wininfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);

	if(!GetVersionEx(reinterpret_cast<OSVERSIONINFO *>(&wininfo)))
		return -1;

	GetSystemInfo(&si);

	// Get the hostname
	if(gethostname(hostname, sizeof(hostname)) == SOCKET_ERROR)
		return -1;

	if(si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
		cputype = "64-bit";
	else if(si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
		cputype = "32-bit";
	else if(si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64)
		cputype = "Itanium 64-bit";

	// Fill the utsname struct with the windows system info
	strcpy(info->sysname, "Windows");
	strcpy(info->nodename, hostname);
	strcpy(info->release, WindowsVer.c_str());
	strcpy(info->version, printfify("%ld.%ld-%ld", wininfo.dwMajorVersion, wininfo.dwMinorVersion, wininfo.dwBuildNumber).c_str());
	strcpy(info->machine, cputype.c_str());

	// Null-Terminate
	info->nodename[strlen(info->nodename) - 1] = '\0';
	info->sysname[strlen(info->sysname) - 1] = '\0';
	info->release[strlen(info->sysname) - 1] = '\0';
	info->version[strlen(info->version) - 1] = '\0';
	info->machine[strlen(info->machine) - 1] = '\0';
}
开发者ID:Justasic,项目名称:Navn,代码行数:42,代码来源:uname.cpp



注:本文中的GetWindowsVersion函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetWord函数代码示例发布时间:2022-05-30
下一篇:
C++ GetWindowsDirectoryW函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap