/* MasterX Artwork, Inc. sample console program
Copyright© MasterX Artwork, Inc. 2001
Written by Mohammad Najmi Bin Bachok
This version was re-written in C.
E-mail : gonejoe@hotmail.com
Web : http://www.geocities.com/m_bachok/ (currently inactive)
This the second revision of WinOne (version 0.0.0.3) */
#include <stdio.h> /* Standard DOS I/O */
#include <stdlib.h> /* Standard C library */
#include <windows.h> /* Windows API */
#include <string.h> /* Standard C string library */
#define NLS_SHIFT_JIS 932 /* Japanese Shift JIS Codepage */
int main(void)
{
char rootdir[3];
ULARGE_INTEGER fc, tot, fr;
OSVERSIONINFO osver;
char strWinDir[255], strWinSysDir[255], strWinTempDir[255], longstrWinTempDir[500];
SetConsoleTitle("MasterX Artwork, Inc. WinOne");
GetWindowsDirectory(strWinDir,255);
GetSystemDirectory(strWinSysDir,255);
GetTempPath(255,strWinTempDir);
strncpy(rootdir, strWinDir, 2);
if(PRIMARYLANGID(GetUserDefaultLangID()) == LANG_JAPANESE)
{
if (GetConsoleOutputCP() == NLS_SHIFT_JIS)
printf(" MûÌWindowsÌo[WÍF...\n");
else
printf(" Anata no Windows no ba-jon wa...\n");
}
else
printf(" Current user language is not set to Japanese.\n"
" Shifting to English version....\n");
printf("\n Windows version information: ");
osver.dwOSVersionInfoSize = sizeof(osver);
if (GetVersionEx(&osver))
{
if (osver.dwPlatformId == VER_PLATFORM_WIN32s)
printf(" Win32 version ");
else if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
{
if (osver.dwMinorVersion == 10)
printf(" Windows 98 ");
else if (osver.dwMinorVersion == 90)
printf(" Windows Millenium Edition ");
else
printf(" Windows 95 ");
}
else if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT)
{
if (osver.dwMajorVersion <= 4)
printf(" Windows NT ");
else if (osver.dwMajorVersion == 5)
{
if (osver.dwMinorVersion == 0)
printf(" Windows 2000 ");
else if (osver.dwMinorVersion == 1)
printf(" Windows XP ");
}
}
}
GetLongPathName(strWinTempDir,longstrWinTempDir,500);
printf("%u.%u.%u\n\n", osver.dwMajorVersion,
osver.dwMinorVersion,(osver.dwBuildNumber & 0xffff));
printf(" Windows directory: %s\n\n",strWinDir);
printf(" Windows System directory: %s\n\n",strWinSysDir);
printf(" Windows TEMP directory: \n %s\n\n",longstrWinTempDir);
printf(" Current user language ID is %u\n\n", GetUserDefaultLangID());
if (SHGetDiskFreeSpace(rootdir, &fc, &tot, &fr))
{
unsigned __int64 totalds = (tot.QuadPart) / 1024l / 1024l;
unsigned __int64 totalfreeds = (fr.QuadPart) / 1024l / 1024l;
printf(" Total disk space on drive %s is %u MB\n", rootdir, totalds);
printf(" Disk free space on drive %s is %u MB\n\n", rootdir, totalfreeds);
}
else
printf(" Cannot get drive %s information...\n\n", rootdir);
printf(" MS-DOS version information:");
system("ver");
printf("\n Using stdlib.h built-in variables:\n"
" Current Windows version is %u.%u.%u\n\n",
_winmajor, _winminor, (_osver & 0xffff));
system("pause");
return 0;
}