clean restrict.cpp
This commit is contained in:
parent
2db187faf5
commit
d8da11f0dc
2 changed files with 48 additions and 61 deletions
|
|
@ -2,72 +2,59 @@
|
|||
|
||||
#include "../types.h"
|
||||
|
||||
bool __cdecl SystemSupported()
|
||||
BOOL __cdecl SystemSupported()
|
||||
{
|
||||
bool v0; // di
|
||||
struct _OSVERSIONINFOA VersionInformation; // [esp+4h] [ebp-94h]
|
||||
OSVERSIONINFO VersionInformation;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
v0 = 0;
|
||||
memset(&VersionInformation, 0, 0x94u);
|
||||
VersionInformation.dwOSVersionInfoSize = 148;
|
||||
if ( GetVersionEx(&VersionInformation)
|
||||
&& VersionInformation.dwPlatformId == 2
|
||||
&& VersionInformation.dwMajorVersion >= 5 )
|
||||
{
|
||||
v0 = 1;
|
||||
}
|
||||
return v0;
|
||||
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 __cdecl RestrictedTest()
|
||||
BOOL __cdecl RestrictedTest()
|
||||
{
|
||||
bool v0; // si
|
||||
FILE *v2; // eax
|
||||
char Buffer[260]; // [esp+4h] [ebp-104h]
|
||||
FILE *f;
|
||||
char Buffer[MAX_PATH];
|
||||
BOOL ret = FALSE;
|
||||
|
||||
v0 = 0;
|
||||
if ( SystemSupported() && GetWindowsDirectory(Buffer, 0x104u) )
|
||||
{
|
||||
strcat(Buffer, "\\Diablo1RestrictedTest.foo");
|
||||
v2 = fopen(Buffer, "wt");
|
||||
if ( v2 )
|
||||
{
|
||||
fclose(v2);
|
||||
remove(Buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
v0 = 1;
|
||||
}
|
||||
}
|
||||
return v0;
|
||||
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 __cdecl ReadOnlyTest()
|
||||
BOOL __cdecl ReadOnlyTest()
|
||||
{
|
||||
bool v0; // si
|
||||
char *v1; // eax
|
||||
FILE *v2; // eax
|
||||
char Filename[260]; // [esp+4h] [ebp-104h]
|
||||
char *c;
|
||||
FILE *f;
|
||||
char Filename[MAX_PATH];
|
||||
BOOL ret = FALSE;
|
||||
|
||||
v0 = 0;
|
||||
if ( GetModuleFileName(ghInst, Filename, 0x104u) )
|
||||
{
|
||||
v1 = strrchr(Filename, '\\');
|
||||
if ( v1 )
|
||||
{
|
||||
strcpy(v1 + 1, "Diablo1ReadOnlyTest.foo");
|
||||
v2 = fopen(Filename, "wt");
|
||||
if ( v2 )
|
||||
{
|
||||
fclose(v2);
|
||||
remove(Filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
v0 = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return v0;
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
#ifndef __RESTRICT_H__
|
||||
#define __RESTRICT_H__
|
||||
|
||||
bool __cdecl SystemSupported();
|
||||
bool __cdecl RestrictedTest();
|
||||
bool __cdecl ReadOnlyTest();
|
||||
BOOL __cdecl SystemSupported();
|
||||
BOOL __cdecl RestrictedTest();
|
||||
BOOL __cdecl ReadOnlyTest();
|
||||
|
||||
#endif /* __RESTRICT_H__ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue