What is the dwMinorVersion for Windows Server 2008R2 SP1? - c++

I have a code wherein I check whether the OS is Windows 2008R2 or not and do stuff accordingly. The following link states that for Windows2008R2, the dwMajorVersion should be 6 and dwMinorVersion would be 1. In my code I check for these 2 values but I have found by logging those values on Windows 2008R2 SP1 OS that the dwMinorVersion is 0, not 1 like the link states.
Does the fact that it is 2008R2 SP1 change the minor version? Also if indeed this is supposed to be 0, then how would I differentiate between 2008R2 and 2008?
EDIT: Added the code snippet
OSVERSIONINFOEX osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
GetVersionEx((LPOSVERSIONINFO )&osvi);
if(osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1)
// do something since this is Windows Server 2008R2 OS.

Related

How can I extract the Short Operating System name using regex in Groovy?

I am trying to obtain the output "Windows Server 2008" from the following input string:"The operating system in the remote workstation is Microsoft Windows Server 2008 R2 Enterprise"
But I only get: "Windows Server" not the "2008"
I tried in www.regex101.com and I believe I have the right regex
def sentence = "The operating system in the remote workstation is Microsoft Windows Server 2008 R2 Enterprise"
def regexWinWorkstation = "Microsoft (Windows [a-zA-Z0-9]+)"
def regexWinServer = "Microsoft (Windows Server [a-zA-Z0-9]+)"
def result = sentence.find(regexWinWorkstation) {
println it[1]
}
if (!result) {
result = sentence.find(regexWinServer){
println it[1]}
}
Expected output: "Windows Server 2008"
Actual output:"Windows Server"
def sentences = [
"The operating system in the remote workstation is Microsoft Windows Server 2008 R2 Enterprise",
"The operating system is Microsoft Windows 10 Professional",
"The operating system is Windows XP"
]
def regexWinOptionalServer = /(?<=Microsoft )?Windows (Server )?[a-zA-Z0-9]+/
sentences.each{
println it.find(regexWinOptionalServer)
}
prints
Windows Server 2008
Windows 10
Windows XP

Could not initialize Direct3D VS 2015 (Win 10)

I'm following the DirectX 11 Series 2 tutorial on rastertek.com. Presently I'm on Tutorial 3 (Initializing DirectX) and for some reason the CreateDeviceAndSwapChain function keeps failing when I run the program. I have followed the steps to link the Windows 10 SDK libraries and includes to the project from here (rastertek.com/dx12tut01.html) and my GPU is an Nvidia 780 Ti. I've also tried his pre-compiled .exe and that works fine. What's the problem? Let me know if screenshots are needed!
//enable debug mode
UINT flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
#if defined( DEBUG ) || defined( _DEBUG )
flags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
//create the swap chain, d3d device, and d3d device context
result = D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, flags, &featureLevel, 1, D3D11_SDK_VERSION, &swapChainDesc, &m_swapChain, &m_device, NULL, &m_deviceContext);
if (FAILED(result)) {
return false;
}
Well, in my case, i have a laptop with intel hd 4400 and geforce 840m (using win10 + visual studio 2015), and i had set featureLevel to 11.1 manually, turned out that intel supports that feature level, but geforce suports maximum 11.0. Anyway, its still not clear what is your problem, what error message is, or anything else, so you can try lower feature level, pass 0 as flags.

Error Side by side

First of all, sorry for the length of this message and for my poor English.
I have a application programmed with Visual C++ 2010 and Windows XP application. If I run the application on the same computer where I have installed the Visual Studio, it works without problems but if I run it from another computer with Windows 7 I get an error.
And the information on the display of events is:
And if I run the application on a computer with Windows XP the error is:
And the event display is:
I have checked the versions that I have installed on three computers msvcr100.dll file. On the computer with windows xp and Visual Studio installed are:
On the computer with Windows XP without Visual Studio are:
And on the computer with Windows 7 are:
You can see that the three computers have the same version of the file (10.0.40219). I have checked the dependencies with "Dependecy Walker" program but has not found anything. Also I uninstalled and installed the Visual Studio 2010 x86 Redistributable but I still have the error.
Can I get help finding a solution?
Thank you very much.
UPDATE:
I have run the command sxstrace with the following result:
=================
Begin Activation Context Generation.
Input Parameter:
Flags = 0
ProcessorArchitecture = x86
CultureFallBacks = en-US;en
ManifestPath = C:\KMQQ760\KMQQ.exe
AssemblyDirectory = C:\KMQQ760\
Application Config File =
INFO: Parsing Manifest File C:\KMQQ760\KMQQ.exe.
INFO: Manifest Definition Identity is kmqq.exe,processorArchitecture="x86",type="win32",version="5.1.0.0".
ERROR: Line 1: XML Syntax error.
ERROR: Activation Context generation failed.
End Activation Context Generation.
=================
Begin Activation Context Generation.
Input Parameter:
Flags = 0
ProcessorArchitecture = x86
CultureFallBacks = en-US;en
ManifestPath = C:\Windows\system32\sppsvc.exe
AssemblyDirectory = C:\Windows\system32\
Application Config File =
INFO: Parsing Manifest File C:\Windows\system32\sppsvc.exe.
INFO: Manifest Definition Identity is System.Security.SoftwareLicensing.Server,processorArchitecture="x86",type="win32",version=" 1.0.0.0".
INFO: Activation Context generation succeeded.
End Activation Context Generation.
And the RT_MANIFEST resource of kmqq.exe is:
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><assemblyIdentity processorArchitecture="x86" version="5.1.0.0" type="win32" name="kmqq.exe"></assemblyIdentity><description>KitchenMaster</description><trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"><security><requestedPrivileges><requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel></requestedPrivileges></security></trustInfo><application xmlns="urn:schemas-microsoft-com:asm.v3"><windowsSettings><ms_windowsSettings:dpiAware xmlns:ms_windowsSettings="http://schemas.microsoft.com/SMI/2005/WindowsSettings" xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</ms_windowsSettings:dpiAware></windowsSettings></application></assembly>
I do not find file version msvcr100.dll is conflicting. Can it be that the error is other?
Thanks in advance.

ShellExecute fails: ERROR_FILE_NOT_FOUND

I'm trying to start my application with my own launcher with administrator rights. The launcher works on my 64Bit Win7 but not at my 32Bit WinXP computer.
The code I am using is this:
wstring fullAppPath = "myapp.exe";
ShellExecuteW(NULL,
L"runas", //admin rights
fullAppPath.c_str(),
NULL, //startup params
NULL, //default dir
SW_SHOWNORMAL
);
I use the MSVC 2010 32Bit compiler with the Qt IDE and the launcher-application and the main-application are in the same directory, which is not C:\Windows\System32.
On my WinXP computer I get anytime I start my launcher an ERROR_FILE_NOT_FOUND error. (value 2)
How can I solve this?
The solution was using an absolute path instead of a relative path.

How to accurately get Windows OS version with C++?

Every link I look at always mentions GetVersionEx, but that doesn't seem very helpful.
My method looks like this,
static int windowsVersion() {
OSVERSIONINFO osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osvi);
return osvi.dwMajorVersion;
}
Which I am running Windows 8 and instead it returns 6.
If I'm trying to accurately get their version of Windows, that isn't very helpful.
Note: I've also checked all the other variables. the dwMinorVersion returns a 4, build number returns something like 8400.
Manual: For Windows 8, dwMajorVersion is 6 and dwMinorVersion is 2
You need to use both the Major and Minor Version Numbers.
Windows Vista 6.0.6000
Windows 7 6.1.7600
Windows 8 64 bit version on my PC returns 6.2.9200
A 6 for dwMajorVersion can mean anything from Windows Vista and up. That's how Microsoft versioning works. 2 for dwMinorVersion should be either Windows 8 or Windows Server 2012. If wProductType == VER_NT_WORKSTATION, you got Windows 8. All of this is explained on MSDN.