Commit 17049acd authored by Mike Hearn's avatar Mike Hearn Committed by Alexandre Julliard

Delete version sniffing logic.

parent 38f2ee9d
......@@ -303,191 +303,6 @@ void VERSION_Init( const WCHAR *appname )
NtClose( config_key );
}
/**********************************************************************
* VERSION_GetSystemDLLVersion
*
* This function tries to figure out if a given (native) dll comes from
* win95/98 or winnt. Since all values in the OptionalHeader are not a
* usable hint, we test if a dll imports the ntdll.
* This is at least working for all system dlls like comctl32, comdlg32 and
* shell32.
* If you have a better idea to figure this out...
*/
static DWORD VERSION_GetSystemDLLVersion( HMODULE hmod )
{
DWORD size;
IMAGE_IMPORT_DESCRIPTOR *pe_imp;
if ((pe_imp = RtlImageDirectoryEntryToData( hmod, TRUE, IMAGE_DIRECTORY_ENTRY_IMPORT, &size )))
{
for ( ; pe_imp->Name; pe_imp++)
{
char * name = (char *)hmod + (unsigned int)pe_imp->Name;
TRACE("%s\n", name);
if (!strncasecmp(name, "ntdll", 5))
{
switch(RtlImageNtHeader(hmod)->OptionalHeader.MajorOperatingSystemVersion) {
case 3:
MESSAGE("WARNING: very old native DLL (NT 3.x) used, might cause instability.\n");
return NT351;
case 4: return NT40;
case 5: switch (RtlImageNtHeader(hmod)->OptionalHeader.MinorOperatingSystemVersion){
case 0: return NT2K;
case 1: return WINXP;
case 2: return WIN2K3;
}
default:
FIXME("Unknown DLL OS version, please report !!\n");
return WIN2K3;
}
}
}
}
return WIN95;
}
/**********************************************************************
* VERSION_GetLinkedDllVersion
*
* Some version data (not reliable!):
* linker/OS/image/subsys
*
* x.xx/1.00/0.00/3.10 Win32s (any version ?)
* 2.39/1.00/0.00/3.10 Win32s freecell.exe (any version)
* 2.50/1.00/4.00/4.00 Win32s 1.30 winhlp32.exe
* 2.60/3.51/3.51/3.51 NT351SP5 system dlls
* 2.60/3.51/3.51/4.00 NT351SP5 comctl32 dll
* 2.xx/1.00/0.00/4.00 Win95 system files
* x.xx/4.00/0.00/4.00 Win95 most applications
* 3.10/4.00/0.00/4.00 Win98 notepad
* x.xx/5.00/5.00/4.00 Win98 system dlls (e.g. comctl32.dll)
* x.xx/4.00/4.00/4.00 NT 4 most apps
* 5.12/5.00/5.00/4.00 NT4+IE5 comctl32.dll
* 5.12/5.00/5.00/4.00 Win98 calc
* x.xx/5.00/5.00/4.00 win95/win98/NT4 IE5 files
* 2.38/4.00/1.00/4.00 Mingw32 applications compiled with mingw32
*/
static DWORD VERSION_GetLinkedDllVersion(void)
{
WINDOWS_VERSION WinVersion = NB_WINDOWS_VERSIONS;
PIMAGE_OPTIONAL_HEADER ophd;
IMAGE_NT_HEADERS *nt;
const WCHAR *name;
PLIST_ENTRY mark, entry;
PLDR_MODULE mod;
unsigned int i;
/* First check the native dlls provided. These have to be
from one windows version */
mark = &NtCurrentTeb()->Peb->LdrData->InLoadOrderModuleList;
for (entry = mark->Flink; entry != mark; entry = entry->Flink)
{
mod = CONTAINING_RECORD(entry, LDR_MODULE, InLoadOrderModuleList);
if (mod->Flags & LDR_WINE_INTERNAL) continue;
nt = RtlImageNtHeader(mod->BaseAddress);
ophd = &nt->OptionalHeader;
name = strrchrW( mod->FullDllName.Buffer, '\\' );
if (name) name++;
else name = mod->FullDllName.Buffer;
TRACE("%s: %02x.%02x/%02x.%02x/%02x.%02x/%02x.%02x\n",
debugstr_w(name), ophd->MajorLinkerVersion, ophd->MinorLinkerVersion,
ophd->MajorOperatingSystemVersion, ophd->MinorOperatingSystemVersion,
ophd->MajorImageVersion, ophd->MinorImageVersion,
ophd->MajorSubsystemVersion, ophd->MinorSubsystemVersion);
for (i = 0; i < sizeof(special_dlls)/sizeof(special_dlls[0]); i++)
{
/* test if it is a special dll */
if (!strcmpiW(name, special_dlls[i]))
{
DWORD DllVersion = VERSION_GetSystemDLLVersion(mod->BaseAddress);
if (WinVersion == NB_WINDOWS_VERSIONS) WinVersion = DllVersion;
else if (WinVersion != DllVersion)
{
ERR("You mixed system DLLs from different windows versions! Expect a crash! (%s: expected version %s, but is %s)\n",
debugstr_w(name),
debugstr_w(VersionData[WinVersion].szCSDVersion),
debugstr_w(VersionData[DllVersion].szCSDVersion));
return WIN20; /* this may let the exe exit */
}
break;
}
}
}
if(WinVersion != NB_WINDOWS_VERSIONS) return WinVersion;
/* we are using no external system dlls, look at the exe */
nt = RtlImageNtHeader(NtCurrentTeb()->Peb->ImageBaseAddress);
ophd = &nt->OptionalHeader;
TRACE("%02x.%02x/%02x.%02x/%02x.%02x/%02x.%02x\n",
ophd->MajorLinkerVersion, ophd->MinorLinkerVersion,
ophd->MajorOperatingSystemVersion, ophd->MinorOperatingSystemVersion,
ophd->MajorImageVersion, ophd->MinorImageVersion,
ophd->MajorSubsystemVersion, ophd->MinorSubsystemVersion);
/* special nt 3.51 */
if (3 == ophd->MajorOperatingSystemVersion && 51 == ophd->MinorOperatingSystemVersion)
{
return NT351;
}
/* the MajorSubsystemVersion is the only usable sign */
if (ophd->MajorSubsystemVersion < 4)
{
if ( ophd->MajorOperatingSystemVersion == 1
&& ophd->MinorOperatingSystemVersion == 0)
{
return WIN31; /* win32s */
}
if (ophd->Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI)
return NT351; /* FIXME: NT 3.1, not tested */
else
return WIN98;
}
switch (ophd->MajorOperatingSystemVersion)
{
case 5:
switch (ophd->MinorOperatingSystemVersion)
{
case 0 : return NT2K;
case 1 : return WINXP;
case 2 : return WIN2K3;
}
break;
case 4:
switch(ophd->MinorOperatingSystemVersion)
{
case 90 : return WINME;
case 10 : return WIN98;
case 0 :
switch(ophd->MajorImageVersion)
{
case 4 : return WIN98; /* most apps will use this */
case 1 : return WIN98; /* this seems to be generated by Mingw32 */
case 0 : return WIN95;
}
break;
}
break;
case 1:
if(ophd->MinorOperatingSystemVersion == 0)
return WIN95;
break;
}
FIXME("Unknown EXE OS version %d.%d, please report !!\n",
ophd->MajorOperatingSystemVersion, ophd->MinorOperatingSystemVersion );
return WIN98;
}
/**********************************************************************
* VERSION_GetVersion
*
......@@ -503,19 +318,11 @@ static DWORD VERSION_GetLinkedDllVersion(void)
*/
static const RTL_OSVERSIONINFOEXW *VERSION_GetVersion(void)
{
static WORD winver = 0xffff;
static WORD winver = WIN98;
if (versionForced)
return &VersionData[forcedWinVersion]; /* user has overridden any sensible checks */
if (winver == 0xffff) /* to be determined */
{
WINDOWS_VERSION retver = VERSION_GetLinkedDllVersion();
/* cache determined value, but do not store in case of WIN31 */
if (retver != WIN31) winver = retver;
return &VersionData[retver];
}
return &VersionData[winver];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment