如何用程序识别操作系统是Vista和还是XP?

xn000 2007-04-26 07:00:01
如何用程序识别操作系统是Vista和还是XP?

使用InstallShield6.3打包程序?需要判断 用户的操作系统是vista还是xp?

xp和vista
可以通过注册表里 的 固定 键值区别么?

...全文
1365 17 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
xn000 2007-09-28
  • 打赏
  • 举报
回复
ISDEV : fatal error -7000: Internal build error
27号早上,

计算机【wfc】:
环境:2000server系统
运行installshield6.31打开安装工程
出现:文件保护,需要插入win2000 sp4安装光盘修复的提示。【这个图片当时没能抓到,后来也没有重现过】
BUILD时出现错误:
Build started at 09/27/07 10:05:24.
Error -7128: The custom build folder specified for the media is invalid. "The custom build folder is not valid syntax or is not a valid absolute path or is not writeable."
Build aborted at 09/27/07 10:05:24.

安装 - 1 error(s), 0 warning(s)

================================================
换另一台计算机【hjgjk】:
环境:2000server系统,还装有installshield6.31和installshield11.5
运新installshield6.31打开安装工程
出现同样的提示和错误。

尝试用installshield6.31新建一个工程:
一直默认下一步到最后,出现提示
The specified project cannot be loaded because the project file does not exist.

打开installshield11.5 执行Build,也出现错误: internal build error -7000
Setup.Rul
Linking...
Setup.inx - 0 error(s), 0 warning(s)
Calculating size of cabinet files...
ISDEV : fatal error -7000: Internal build error
Release 1 - 1 error(s), 0 warning(s)


================================================
执行修复,重新安装,断网, 错误提示还是一样的。

再换一台计算机:
找了一台装有winxp系统的计算机,安装installshield6.31和installshield6.31中文包。
同样的安装工程【在wfc,build时报错的安装工程】
打开时提示:
服务器正在运行中
由于另一个程序正在运行中,此操作无法完成。请选择"切换到"来激活正在运行中的程序,并更正此问题。

需要等10秒钟安装工程开始加载

================================================
检查计算机没有病毒!!
xn000 2007-09-28
  • 打赏
  • 举报
回复
ISDEV : fatal error -7000: Internal build error
27号早上,

计算机【wfc】:
环境:2000server系统
运行installshield6.31打开安装工程
出现:文件保护,需要插入win2000 sp4安装光盘修复的提示。【这个图片当时没能抓到,后来也没有重现过】
BUILD时出现错误:
Build started at 09/27/07 10:05:24.
Error -7128: The custom build folder specified for the media is invalid. "The custom build folder is not valid syntax or is not a valid absolute path or is not writeable."
Build aborted at 09/27/07 10:05:24.

安装 - 1 error(s), 0 warning(s)

================================================
换另一台计算机【hjgjk】:
环境:2000server系统,还装有installshield6.31和installshield11.5
运新installshield6.31打开安装工程
出现同样的提示和错误。

尝试用installshield6.31新建一个工程:
一直默认下一步到最后,出现提示
The specified project cannot be loaded because the project file does not exist.

打开installshield11.5 执行Build,也出现错误: internal build error -7000
Setup.Rul
Linking...
Setup.inx - 0 error(s), 0 warning(s)
Calculating size of cabinet files...
ISDEV : fatal error -7000: Internal build error
Release 1 - 1 error(s), 0 warning(s)


================================================
执行修复,重新安装,断网, 错误提示还是一样的。

再换一台计算机:
找了一台装有winxp系统的计算机,安装installshield6.31和installshield6.31中文包。
同样的安装工程【在wfc,build时报错的安装工程】
打开时提示:
服务器正在运行中
由于另一个程序正在运行中,此操作无法完成。请选择"切换到"来激活正在运行中的程序,并更正此问题。

需要等10秒钟安装工程开始加载

================================================
检查计算机没有病毒!!
xn000 2007-09-28
  • 打赏
  • 举报
回复
ISDEV : fatal error -7000: Internal build error
27号早上,

计算机【wfc】:
环境:2000server系统
运行installshield6.31打开安装工程
出现:文件保护,需要插入win2000 sp4安装光盘修复的提示。【这个图片当时没能抓到,后来也没有重现过】
BUILD时出现错误:
Build started at 09/27/07 10:05:24.
Error -7128: The custom build folder specified for the media is invalid. "The custom build folder is not valid syntax or is not a valid absolute path or is not writeable."
Build aborted at 09/27/07 10:05:24.

安装 - 1 error(s), 0 warning(s)

================================================
换另一台计算机【hjgjk】:
环境:2000server系统,还装有installshield6.31和installshield11.5
运新installshield6.31打开安装工程
出现同样的提示和错误。

尝试用installshield6.31新建一个工程:
一直默认下一步到最后,出现提示
The specified project cannot be loaded because the project file does not exist.

打开installshield11.5 执行Build,也出现错误: internal build error -7000
Setup.Rul
Linking...
Setup.inx - 0 error(s), 0 warning(s)
Calculating size of cabinet files...
ISDEV : fatal error -7000: Internal build error
Release 1 - 1 error(s), 0 warning(s)


================================================
执行修复,重新安装,断网, 错误提示还是一样的。

再换一台计算机:
找了一台装有winxp系统的计算机,安装installshield6.31和installshield6.31中文包。
同样的安装工程【在wfc,build时报错的安装工程】
打开时提示:
服务器正在运行中
由于另一个程序正在运行中,此操作无法完成。请选择"切换到"来激活正在运行中的程序,并更正此问题。

需要等10秒钟安装工程开始加载

================================================
检查计算机没有病毒!!
gf101xt 2007-08-11
  • 打赏
  • 举报
回复
关注 啊
misto 2007-07-13
  • 打赏
  • 举报
回复
GetVersion或GetVersionEx 好像也就这算是一个好的方法了啊
tomquan 2007-06-27
  • 打赏
  • 举报
回复
顶!~~~
Johnses 2007-06-27
  • 打赏
  • 举报
回复
Getting the System Version:
(ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.WIN32COM.v10.en/sysinfo/base/getting_the_system_version.htm)

#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#define BUFSIZE 80
typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
int _tmain()
{
OSVERSIONINFOEX osvi;
SYSTEM_INFO si;
PGNSI pGNSI;
BOOL bOsVersionInfoEx;

ZeroMemory(&si, sizeof(SYSTEM_INFO));
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);

if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) )
{
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
if (! GetVersionEx ( (OSVERSIONINFO *) &osvi) )
return FALSE;
}
pGNSI = (PGNSI) GetProcAddress(
GetModuleHandle(TEXT("kernel32.dll")),
"GetNativeSystemInfo");
if(NULL != pGNSI)
pGNSI(&si);
else GetSystemInfo(&si);

switch (osvi.dwPlatformId)
{
case VER_PLATFORM_WIN32_NT:
if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0 )
{
if( osvi.wProductType == VER_NT_WORKSTATION )
printf ("Windows Vista ");
else printf ("Windows Server \"Longhorn\" " );
}

if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 )
{
if( GetSystemMetrics(SM_SERVERR2) )
printf( "Microsoft Windows Server 2003 \"R2\" ");
else if( osvi.wProductType == VER_NT_WORKSTATION &&
si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64)
{
printf( "Microsoft Windows XP Professional x64 Edition ");
}
else printf ("Microsoft Windows Server 2003, ");
}

if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 )
printf ("Microsoft Windows XP ");

if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 )
printf ("Microsoft Windows 2000 ");

if ( osvi.dwMajorVersion <= 4 )
printf ("Microsoft Windows NT ");
if( bOsVersionInfoEx )
{
if ( osvi.wProductType == VER_NT_WORKSTATION &&
si.wProcessorArchitecture!=PROCESSOR_ARCHITECTURE_AMD64)
{
if( osvi.dwMajorVersion == 4 )
printf ( "Workstation 4.0 " );
else if( osvi.wSuiteMask & VER_SUITE_PERSONAL )
printf ( "Home Edition " );
else printf ( "Professional " );
}
else if ( osvi.wProductType == VER_NT_SERVER ||
osvi.wProductType == VER_NT_DOMAIN_CONTROLLER )
{
if(osvi.dwMajorVersion==5 && osvi.dwMinorVersion==2)
{
if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_IA64 )
{
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
printf ( "Datacenter Edition for Itanium-based Systems" );
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
printf ( "Enterprise Edition for Itanium-based Systems" );
}

else if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64 )
{
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
printf ( "Datacenter x64 Edition " );
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
printf ( "Enterprise x64 Edition " );
else printf( "Standard x64 Edition " );
}

else
{
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
printf ( "Datacenter Edition " );
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
printf ( "Enterprise Edition " );
else if ( osvi.wSuiteMask & VER_SUITE_BLADE )
printf ( "Web Edition " );
else printf ( "Standard Edition " );
}
}
else if(osvi.dwMajorVersion==5 && osvi.dwMinorVersion==0)
{
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
printf ( "Datacenter Server " );
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
printf ( "Advanced Server " );
else printf ( "Server " );
}
else // Windows NT 4.0
{
if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
printf ("Server 4.0, Enterprise Edition " );
else printf ( "Server 4.0 " );
}
}
}
else
{
HKEY hKey;
TCHAR szProductType[BUFSIZE];
DWORD dwBufLen=BUFSIZE*sizeof(TCHAR);
LONG lRet;

lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
TEXT("SYSTEM\\CurrentControlSet\\Control\\ProductOptions"),
0, KEY_QUERY_VALUE, &hKey );
if( lRet != ERROR_SUCCESS )
return FALSE;

lRet = RegQueryValueEx( hKey, TEXT("ProductType"), NULL, NULL,
(LPBYTE) szProductType, &dwBufLen);
RegCloseKey( hKey );

if( (lRet != ERROR_SUCCESS) || (dwBufLen > BUFSIZE*sizeof(TCHAR)) )
return FALSE;

if ( lstrcmpi( TEXT("WINNT"), szProductType) == 0 )
printf( "Workstation " );
if ( lstrcmpi( TEXT("LANMANNT"), szProductType) == 0 )
printf( "Server " );
if ( lstrcmpi( TEXT("SERVERNT"), szProductType) == 0 )
printf( "Advanced Server " );
printf( "%d.%d ", osvi.dwMajorVersion, osvi.dwMinorVersion );
}
if( osvi.dwMajorVersion == 4 &&
lstrcmpi( osvi.szCSDVersion, TEXT("Service Pack 6") ) == 0 )
{
HKEY hKey;
LONG lRet;
lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Hotfix\\Q246009"),
0, KEY_QUERY_VALUE, &hKey );
if( lRet == ERROR_SUCCESS )
printf( "Service Pack 6a (Build %d)\n",
osvi.dwBuildNumber & 0xFFFF );
else // Windows NT 4.0 prior to SP6a
{
_tprintf( TEXT("%s (Build %d)\n"),
osvi.szCSDVersion,
osvi.dwBuildNumber & 0xFFFF);
}

RegCloseKey( hKey );
}
else // not Windows NT 4.0
{
_tprintf( TEXT("%s (Build %d)\n"),
osvi.szCSDVersion,
osvi.dwBuildNumber & 0xFFFF);
}

break;
}
return TRUE;
}
xn000 2007-06-14
  • 打赏
  • 举报
回复
还是需要自己解决:
installshield提供函数可以解决。



SYSINFO.nWinMajor

4 The operating system is Windows NT 4.0.
5 The operating system is Windows Server 2003 R2, Windows Server 2003,
Windows XP,or Windows 2000.
6 The operating system is Windows Vista or Windows Server 2008.

SYSINFO.nWinMinor

0 The operating system is Windows Vista, Windows Server 2008, Windows 2000, or
Windows NT 4.0.
1 The operating system is Windows XP.
2 The operating system is Windows Server 2003 R2, Windows Server 2003,
or Windows XP Professional x64 Edition.


http://msdn2.microsoft.com/en-us/library/ms724833.aspx




GetSystemInfo (WINMINOR, nvResult, svResult);
GetSystemInfo (WINMAJOR, nvResult, svResult);
paigle 2007-06-04
  • 打赏
  • 举报
回复
GetVersion或GetVersionEx
xn000 2007-06-03
  • 打赏
  • 举报
回复
GETVERSION
hnawei 2007-05-05
  • 打赏
  • 举报
回复
通过GETVERSION函数,WIN32平台,主版本号是6,副版本号是0.
xn000 2007-05-03
  • 打赏
  • 举报
回复
hehe到现在还没有人能给我答案么?

我只能通过判断注册表中系统版本这种粗略的方法了
smallcrocodile 2007-04-27
  • 打赏
  • 举报
回复
好像有个什么API的,很容易
ljc007 2007-04-26
  • 打赏
  • 举报
回复
开始-运行-cmd-ver
Gness 2007-04-26
  • 打赏
  • 举报
回复
InstallShield 12都不能很好的支持Vista
xn000 2007-04-26
  • 打赏
  • 举报
回复
这样的问题 我在网上看见过1个,但是没有答案适合我

他的答案是 安装InstallShield的更高版本??

但是我想是应该可以区别的??????????????

andyzgx1 2007-04-26
  • 打赏
  • 举报
回复
帮顶下

18,141

社区成员

发帖
与我相关
我的任务
社区描述
Windows客户端使用相关问题交流社区
社区管理员
  • Windows客户端使用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧