Exemplo n.º 1
0
//BOOL vncVideoDriver::LookupVideoDevice(LPCTSTR szDeviceString, INT &devNum, DISPLAY_DEVICE *pDd)
BOOL vncVideoDriver::LookupVideoDeviceAlt(
		LPCTSTR szDevStr,
		LPCTSTR szDevStrAlt,
		INT &devNum,
		DISPLAY_DEVICE *pDd)
{
	_ASSERTE(IsWinVerOrHigher(5, 0));

	pEnumDisplayDevices pd = NULL;
	HINSTANCE  hInstUser32 = LoadNImport("User32.DLL", "EnumDisplayDevicesA", pd);
	if (!hInstUser32) return FALSE;

	ZeroMemory(pDd, sizeof(DISPLAY_DEVICE));
	pDd->cb = sizeof(DISPLAY_DEVICE);
	BOOL result;
	while (result = (*pd)(NULL,devNum, pDd, 0))
	{
		if (strcmp((const char *)pDd->DeviceString, szDevStr) == 0 ||
			szDevStrAlt && strcmp((const char *)pDd->DeviceString, szDevStrAlt) == 0)
		{
			vnclog.Print(
				LL_INTINFO,
				VNCLOG("Found display device \"%s\": \"%s\"\n"),
				pDd->DeviceString,
				pDd->DeviceName);
			break;
		}
		devNum++;
	}

	FreeLibrary(hInstUser32);
	return result;
}
Exemplo n.º 2
0
BOOL vncVideoDriver::TestMapped()
{
	_ASSERTE(IsWinNT());

	TCHAR *pDevName;
	if (IsWinVerOrHigher(5, 0))
	{
		DISPLAY_DEVICE dd;
		INT devNum = 0;
		if (!LookupVideoDeviceAlt(szDriverString, szDriverStringAlt, devNum, &dd))
			return FALSE;
		pDevName = (TCHAR *)dd.DeviceName;
	}
	else
	{
		pDevName = "DISPLAY";
	}

	HDC	l_ddc = ::CreateDC(pDevName, NULL, NULL, NULL);
	if (l_ddc)
	{
		BOOL b = ExtEscape(l_ddc, TESTMAPPED, 0, NULL, 0, NULL);	
		DeleteDC(l_ddc);
		return b;
	}
	return FALSE;
}
Exemplo n.º 3
0
// Windows 7 and higher
bool IsWin7()
{
	static int ibIsWin7 = 0;
	if (!ibIsWin7)
	{
		_ASSERTE(_WIN32_WINNT_WIN7 == 0x601);
		ibIsWin7 = IsWinVerOrHigher(_WIN32_WINNT_WIN7) ? 1 : -1;
	}
	return (ibIsWin7 == 1);
}
Exemplo n.º 4
0
// Vista and higher
bool IsWin6()
{
	static int ibIsWin6 = 0;
	if (!ibIsWin6)
	{
		_ASSERTE(_WIN32_WINNT_WIN6 == 0x600);
		ibIsWin6 = IsWinVerOrHigher(_WIN32_WINNT_WIN6) ? 1 : -1;
	}
	return (ibIsWin6 == 1);
}
Exemplo n.º 5
0
// Windows 10 and higher
bool IsWin10()
{
	static int ibIsWin10 = 0;
	if (!ibIsWin10)
	{
		#define _WIN32_WINNT_WIN10 0x604
		ibIsWin10 = IsWinVerOrHigher(_WIN32_WINNT_WIN10) ? 1 : -1;
	}
	return (ibIsWin10 == 1);
}
Exemplo n.º 6
0
// Windows 8.1 and higher
bool IsWin8_1()
{
	static int ibIsWin8_1 = 0;
	if (!ibIsWin8_1)
	{
		#ifndef _WIN32_WINNT_WIN8_1
		#define _WIN32_WINNT_WIN8_1 0x603
		#endif
		_ASSERTE(_WIN32_WINNT_WIN8_1 == 0x603);
		ibIsWin8_1 = IsWinVerOrHigher(_WIN32_WINNT_WIN8_1) ? 1 : -1;
	}
	return (ibIsWin8_1 == 1);
}
Exemplo n.º 7
0
// Windows 8 and higher
bool IsWin8()
{
	static int ibIsWin8 = 0;
	if (!ibIsWin8)
	{
		#ifndef _WIN32_WINNT_WIN8
		#define _WIN32_WINNT_WIN8 0x602
		#endif
		_ASSERTE(_WIN32_WINNT_WIN8 == 0x602);
		ibIsWin8 = IsWinVerOrHigher(_WIN32_WINNT_WIN8) ? 1 : -1;
	}
	return (ibIsWin8 == 1);
}
Exemplo n.º 8
0
void vncVideoDriver::Deactivate()
{
	_ASSERTE(IsWinNT());

	if (IsWinVerOrHigher(5, 0))
	{
		Deactivate_NT50();
	}
	else
	{
		Deactivate_NT46();
	}
}
Exemplo n.º 9
0
BOOL vncVideoDriver::Activate(
		BOOL fForDirectAccess,
		const RECT *prcltarget)
{
	_ASSERTE(IsWinNT());

	if (IsWinVerOrHigher(5, 0))
	{
		return Activate_NT50(fForDirectAccess, prcltarget);
	}
	else
	{
// NOTE: prcltarget is just a SourceDisplayRect.
// there is only 1 possibility on NT4, so safely ignore it
		return Activate_NT46(fForDirectAccess);
	}
}
Exemplo n.º 10
0
// Windows 10 and higher
bool IsWin10()
{
	static int ibIsWin10 = 0;
	if (!ibIsWin10)
	{
		// First insider builds of Win10 were numbered as 6.4
		// Now it's a 10.0, but we still compare with ‘old’ number
		#ifndef _WIN32_WINNT_WIN10_PREVIEW
		#define _WIN32_WINNT_WIN10_PREVIEW 0x604
		#endif
		_ASSERTE(_WIN32_WINNT_WIN10_PREVIEW == 0x604);
		ibIsWin10 = IsWinVerOrHigher(_WIN32_WINNT_WIN10_PREVIEW) ? 1 : -1;

		//BUGBUG: It return FALSE on Win10 when our dll is loaded into some app (Far.exe) without new manifest/OSGUID

		if ((ibIsWin10 == -1) && IsWin8_1())
		{
			HMODULE hKernel32 = GetModuleHandle(L"kernel32.dll");
			if (hKernel32)
			{
				FARPROC pfnCheck = hKernel32 ? (FARPROC)GetProcAddress(hKernel32, "FreeMemoryJobObject") : NULL;
				// Seems like it's a Win10
				if (pfnCheck)
				{
					ibIsWin10 = 1;
				}
				/*
				VS_FIXEDFILEINFO OsVer = {};
				wchar_t szKernelPath[MAX_PATH] = L"";
				if (!GetModuleFileName(hKernel32, szKernelPath, countof(szKernelPath)))
					wcscpy_c(szKernelPath, L"kernel32.dll");
				// Is returns 6.3 too!
				if (LoadModuleVersion(szKernelPath, OsVer))
				{
					if (HIWORD(OsVer.dwFileVersionMS) >= 10)
					{
						ibIsWin10 = 1;
					}
				}
				*/
			}
		}
	}
	return (ibIsWin10 == 1);
}
Exemplo n.º 11
0
Arquivo: RDV.cpp Projeto: Chessa/rdp
// CRDVApp initialization
BOOL CRDVApp::InitInstance()
{
	// InitCommonControlsEx() is required on Windows XP if an application
	// manifest specifies use of ComCtl32.dll version 6 or later to enable
	// visual styles.  Otherwise, any window creation will fail.
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);

	// Set this to include all the common control classes you want to use
	// in your application.
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinApp::InitInstance();

	if (!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}

	// Test the O/S version information for XP or later
	if (!IsWinNT() || !IsWinVerOrHigher(5,1))
	{
		AfxMessageBox("Requires Windows XP or later");
		return FALSE;
	}

	// Initialize OLE libraries
	if (!AfxOleInit())
	{
		AfxMessageBox(IDP_OLE_INIT_FAILED);
		return FALSE;
	}
	AfxEnableControlContainer();

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	// of your final executable, you should remove from the following
	// the specific initialization routines you do not need
	// Change the registry key under which our settings are stored
	// TODO: You should modify this string to be something appropriate
	// such as the name of your company or organization
	SetRegistryKey(_T("Remote Desktop System"));
	LoadStdProfileSettings(4);  // Load standard INI file options (including MRU)

	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views
	CMultiDocTemplate* pDocTemplate;
	pDocTemplate = new CMultiDocTemplate(IDR_RDVTYPE,
		RUNTIME_CLASS(CRDVDoc),
		RUNTIME_CLASS(CChildFrame), // custom MDI child frame
		RUNTIME_CLASS(CRDVView));
	if (!pDocTemplate)
		return FALSE;
	AddDocTemplate(pDocTemplate);

	// create main MDI Frame window
	CMainFrame* pMainFrame = new CMainFrame;
	if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME))
	{
		delete pMainFrame;
		return FALSE;
	}
	m_pMainWnd = pMainFrame;

	// call DragAcceptFiles only if there's a suffix
	//  In an MDI app, this should occur immediately after setting m_pMainWnd
	// Enable drag/drop open
	m_pMainWnd->DragAcceptFiles();

	// Enable DDE Execute open
	EnableShellOpen();
	RegisterShellFileTypes(TRUE);

	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	// Prevent an initial document from being created
	cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;

	// Dispatch commands specified on the command line.  Will return FALSE if
	// app was launched with /RegServer, /Register, /Unregserver or /Unregister.
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;
	// The main window has been initialized, so show and update it
	pMainFrame->ShowWindow(m_nCmdShow);
	pMainFrame->UpdateWindow();

	return TRUE;
}