Beispiel #1
0
string DLCODESTORM::dlcs_get_os_version() {
    string x="Unknown OS";
#ifdef DLCS_WINDOWS
    dlcsm_make_str(szTemp); dlcsm_make_str(szTemp2);
    OSVERSIONINFOEX osvi;
    BOOL bOsVersionInfoEx;
    ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
    osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
    if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) ) {
        osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
        if (! GetVersionEx ( (OSVERSIONINFO *) &osvi) ) {
            x="Windows Unknown Version";
            return x;
        }
    }
    switch (osvi.dwPlatformId) {
    case VER_PLATFORM_WIN32_NT:
        if(osvi.dwMajorVersion <= 4 ) strcpy(szTemp,"Windows NT ");
        if(osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0) strcpy(szTemp,"Windows 2000 ");
        if(osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1) strcpy(szTemp,"Windows XP ");
        if(osvi.dwMajorVersion == 6 && osvi.dwMinorVersion==0) {
            if(osvi.wProductType == VER_NT_WORKSTATION)     strcpy(szTemp,"Windows Server 2008 ");
            else                                            strcpy(szTemp,"Windows Vista ");
        }
        if(osvi.dwMajorVersion == 6 && osvi.dwMinorVersion==1) {
            if(osvi.wProductType == VER_NT_WORKSTATION)     strcpy(szTemp,"Windows Server 2008 R2 ");
            else                                            strcpy(szTemp,"Windows 7 ");
        }
        if(osvi.dwMajorVersion == 6 && osvi.dwMinorVersion==2) {
            if(osvi.wProductType == VER_NT_WORKSTATION)     strcpy(szTemp,"Windows 8 ");
            else                                            strcpy(szTemp,"Windows Server 2012 ");
        }

        sprintf(szTemp2,"version %d.%d %s (Build %d)",
                (int)osvi.dwMajorVersion,
                (int)osvi.dwMinorVersion,
                osvi.szCSDVersion,
                (int)osvi.dwBuildNumber & 0xFFFF);
        strcat(szTemp,szTemp2);
        break;
    case VER_PLATFORM_WIN32_WINDOWS:
        if(osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0) sprintf(szTemp,"Windows 95 %s",osvi.szCSDVersion);
        if(osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10)sprintf(szTemp,"Windows 98 %s",osvi.szCSDVersion);
        if(osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90) strcpy(szTemp,"Windows ME");
        break;
    }
    /*

 PGPI pGPI = (PGPI) GetProcAddress(
            GetModuleHandle(TEXT("kernel32.dll")),
            "GetProductInfo");


    pGPI( osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType);
     switch( dwType )  {
        case PRODUCT_ULTIMATE:
           // StringCchCat(pszOS, BUFSIZE, TEXT("Ultimate Edition" ));
           break;
        case PRODUCT_PROFESSIONAL:
           // StringCchCat(pszOS, BUFSIZE, TEXT("Professional" ));
           break;
        case PRODUCT_HOME_PREMIUM:
           // StringCchCat(pszOS, BUFSIZE, TEXT("Home Premium Edition" ));
           break;
        case PRODUCT_HOME_BASIC:
           // StringCchCat(pszOS, BUFSIZE, TEXT("Home Basic Edition" ));
           break;
        case PRODUCT_ENTERPRISE:
           // StringCchCat(pszOS, BUFSIZE, TEXT("Enterprise Edition" ));
           break;
        case PRODUCT_BUSINESS:
           // StringCchCat(pszOS, BUFSIZE, TEXT("Business Edition" ));
           break;
        case PRODUCT_STARTER:
           // StringCchCat(pszOS, BUFSIZE, TEXT("Starter Edition" ));
           break;
        case PRODUCT_CLUSTER_SERVER:
           // StringCchCat(pszOS, BUFSIZE, TEXT("Cluster Server Edition" ));
           break;
        case PRODUCT_DATACENTER_SERVER:
           // StringCchCat(pszOS, BUFSIZE, TEXT("Datacenter Edition" ));
           break;
        case PRODUCT_DATACENTER_SERVER_CORE:
           // StringCchCat(pszOS, BUFSIZE, TEXT("Datacenter Edition (core installation)" ));
           break;
        case PRODUCT_ENTERPRISE_SERVER:
           // StringCchCat(pszOS, BUFSIZE, TEXT("Enterprise Edition" ));
           break;
        case PRODUCT_ENTERPRISE_SERVER_CORE:
           // StringCchCat(pszOS, BUFSIZE, TEXT("Enterprise Edition (core installation)" ));
           break;
        case PRODUCT_ENTERPRISE_SERVER_IA64:
           // StringCchCat(pszOS, BUFSIZE, TEXT("Enterprise Edition for Itanium-based Systems" ));
           break;
        case PRODUCT_SMALLBUSINESS_SERVER:
           // StringCchCat(pszOS, BUFSIZE, TEXT("Small Business Server" ));
           break;
        case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM:
           // StringCchCat(pszOS, BUFSIZE, TEXT("Small Business Server Premium Edition" ));
           break;
        case PRODUCT_STANDARD_SERVER:
           // StringCchCat(pszOS, BUFSIZE, TEXT("Standard Edition" ));
           break;
        case PRODUCT_STANDARD_SERVER_CORE:
           // StringCchCat(pszOS, BUFSIZE, TEXT("Standard Edition (core installation)" ));
           break;
        case PRODUCT_WEB_SERVER:
           // StringCchCat(pszOS, BUFSIZE, TEXT("Web Server Edition" ));
           break;
        default:
            break;
        }
        }
        */


    x.assign(szTemp);

#endif
#ifdef DLCSM_LINUX
    x.assign("LINUX");
    int z;
    struct utsname l_un;
    z=uname(&l_un);
    if(z==-1) {}
    else x.assign( va("%s %s %s", l_un.sysname, l_un.release, l_un.version));
#endif
    return x;
}
Beispiel #2
0
//////////////////////////////////////////////////////////////// GFX SYSTEM FUNCTIONS
bool C_GFX2D::InitializeGFX( int w, int h, int c, bool FullScreen, string wincaption, CLog *pUSELOG) {
    pLog=pUSELOG;
    pLog->_Add("Init SDL GFX Subsystem...");
    bSDLFailed=false;
#ifdef __linux__
putenv("SDL_VIDEODRIVER=x11");
#endif
    SDL_InitSubSystem(SDL_INIT_VIDEO);
    bCreatedLog=false;
    bFullScreen =FullScreen;
    ScreenWidth =w;
    ScreenHeight=h;
    ScreenColors=c;
    VideoFlags = SDL_HWPALETTE|SDL_DOUBLEBUF;
    if(bFullScreen) VideoFlags |= SDL_FULLSCREEN;
    SDL_version ver;
    SDL_VERSION(&ver);
    pLog->_Add("SDL Version %d.%d.%d",ver.major,ver.minor,ver.patch);
    dlcsm_make_str(vdriver);
    SDL_VideoDriverName(vdriver,sizeof(vdriver));
    pLog->_Add("Video driver[%s]",vdriver);
    VideoModes = SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
    if(VideoModes == (SDL_Rect **)0){
    }
    else {
        if(VideoModes == (SDL_Rect **)-1) pLog->_DebugAdd("All resolutions available");
        else {
            pLog->_DebugAdd("Available Modes");
            for(int i=0;VideoModes[i];++i)
                pLog->_DebugAdd("  %d x %d", VideoModes[i]->w, VideoModes[i]->h);
        }
    }
    const SDL_VideoInfo * VideoInfo = SDL_GetVideoInfo();
    if(VideoInfo) {
        pLog->_DebugAdd("VideoInfo->hw_available [%d]        ",VideoInfo->hw_available);
        pLog->_DebugAdd("VideoInfo->wm_available [%d]        ",VideoInfo->wm_available);
        pLog->_DebugAdd("VideoInfo->blit_hw [%d]             ",VideoInfo->blit_hw);
        pLog->_DebugAdd("VideoInfo->blit_hw_CC [%d]          ",VideoInfo->blit_hw_CC);
        pLog->_DebugAdd("VideoInfo->blit_hw_A [%d]           ",VideoInfo->blit_hw_A);
        pLog->_DebugAdd("VideoInfo->blit_sw [%d]             ",VideoInfo->blit_sw);
        pLog->_DebugAdd("VideoInfo->blit_sw_CC [%d]          ",VideoInfo->blit_sw_CC);
        pLog->_DebugAdd("VideoInfo->blit_sw_A [%d]           ",VideoInfo->blit_sw_A);
        pLog->_DebugAdd("VideoInfo->blit_fill [%d]           ",VideoInfo->blit_fill);
        pLog->_DebugAdd("VideoInfo->video_mem [%d]           ",VideoInfo->video_mem);
        pLog->_DebugAdd("VideoInfo->vfmt->BitsPerPixel [%d]  ",VideoInfo->vfmt->BitsPerPixel);
        pLog->_DebugAdd("VideoInfo->vfmt->BytesPerPixel [%d] ",VideoInfo->vfmt->BytesPerPixel);
        pLog->_DebugAdd("VideoInfo->vfmt->Rloss [%d]         ",VideoInfo->vfmt->Rloss);
        pLog->_DebugAdd("VideoInfo->vfmt->Gloss [%d]         ",VideoInfo->vfmt->Gloss);
        pLog->_DebugAdd("VideoInfo->vfmt->Bloss [%d]         ",VideoInfo->vfmt->Bloss);
        pLog->_DebugAdd("VideoInfo->vfmt->Aloss [%d]         ",VideoInfo->vfmt->Aloss);
        pLog->_DebugAdd("VideoInfo->vfmt->Rshift [%d]        ",VideoInfo->vfmt->Rshift);
        pLog->_DebugAdd("VideoInfo->vfmt->Gshift [%d]        ",VideoInfo->vfmt->Gshift);
        pLog->_DebugAdd("VideoInfo->vfmt->Bshift [%d]        ",VideoInfo->vfmt->Bshift);
        pLog->_DebugAdd("VideoInfo->vfmt->Ashift [%d]        ",VideoInfo->vfmt->Ashift);
        pLog->_DebugAdd("VideoInfo->vfmt->Rmask [%d]         ",VideoInfo->vfmt->Rmask);
        pLog->_DebugAdd("VideoInfo->vfmt->Gmask [%d]         ",VideoInfo->vfmt->Gmask);
        pLog->_DebugAdd("VideoInfo->vfmt->Bmask [%d]         ",VideoInfo->vfmt->Bmask);
        pLog->_DebugAdd("VideoInfo->vfmt->Amask [%d]         ",VideoInfo->vfmt->Amask);
        pLog->_DebugAdd("VideoInfo->vfmt->colorkey [%d]      ",VideoInfo->vfmt->colorkey);
        pLog->_DebugAdd("VideoInfo->vfmt->alpha [%d]         ",VideoInfo->vfmt->alpha);
    } else {
        bSDLFailed=true;
        pLog->_Add("Failed getting Video Info : %s",SDL_GetError());
        return false;
    }
    if(VideoInfo->hw_available) { VideoFlags |= SDL_HWSURFACE; pLog->_Add("Hardware surfaces...");}
    else { VideoFlags |= SDL_SWSURFACE; pLog->_Add("Software surfaces..."); }
    if(VideoInfo->blit_hw) { VideoFlags |= SDL_HWACCEL; pLog->_Add("Hardware acceleration enabled!"); }

    if(SDL_VideoModeOK(ScreenWidth,ScreenHeight,ScreenColors,VideoFlags)) {    }
    else { pLog->_Add("SDL_VideoModeOK failure");         return false;    }
    pScreen=SDL_SetVideoMode(ScreenWidth,ScreenHeight,ScreenColors,VideoFlags);
    if(!pScreen) {
        bSDLFailed=true;
        pLog->_Add("SDL_SetVideoMode failed");
        return false;
    }
    SDL_ShowCursor(SDL_DISABLE);
    SetWindowTitle(wincaption);
    pLog->_Add("SDL GFX Initialized");
    return true;
}