Now diablo.h is treated in the same way as all other header files of Source, as it only contains the declarations of global variables and functions of diablo.cpp. Besides consistency, this also enables mods to include diablo.h just like any other header file without having to include every header file (and without having to include C++ specific aspects of the now all.h).
58 lines
1.1 KiB
C++
58 lines
1.1 KiB
C++
#include "all.h"
|
|
|
|
BOOL SystemSupported()
|
|
{
|
|
OSVERSIONINFO VersionInformation;
|
|
BOOL ret = FALSE;
|
|
|
|
memset(&VersionInformation, 0, sizeof(VersionInformation));
|
|
VersionInformation.dwOSVersionInfoSize = sizeof(VersionInformation);
|
|
if (GetVersionEx(&VersionInformation)
|
|
&& VersionInformation.dwPlatformId == VER_PLATFORM_WIN32_NT
|
|
&& VersionInformation.dwMajorVersion >= 5) {
|
|
ret = TRUE;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
BOOL RestrictedTest()
|
|
{
|
|
FILE *f;
|
|
char Buffer[MAX_PATH];
|
|
BOOL ret = FALSE;
|
|
|
|
if (SystemSupported() && GetWindowsDirectory(Buffer, sizeof(Buffer))) {
|
|
strcat(Buffer, "\\Diablo1RestrictedTest.foo");
|
|
f = fopen(Buffer, "wt");
|
|
if (f) {
|
|
fclose(f);
|
|
remove(Buffer);
|
|
} else {
|
|
ret = TRUE;
|
|
}
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
BOOL ReadOnlyTest()
|
|
{
|
|
char *c;
|
|
FILE *f;
|
|
char Filename[MAX_PATH];
|
|
BOOL ret = FALSE;
|
|
|
|
if (GetModuleFileName(ghInst, Filename, sizeof(Filename))) {
|
|
c = strrchr(Filename, '\\');
|
|
if (c) {
|
|
strcpy(c + 1, "Diablo1ReadOnlyTest.foo");
|
|
f = fopen(Filename, "wt");
|
|
if (f) {
|
|
fclose(f);
|
|
remove(Filename);
|
|
} else {
|
|
ret = TRUE;
|
|
}
|
|
}
|
|
}
|
|
return ret;
|
|
}
|