Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
73 lines
1.8 KiB
C++
73 lines
1.8 KiB
C++
#include <windows.h>
|
|
#include <string.h>
|
|
|
|
#include "Z3D_SetupDirectX.h"
|
|
|
|
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
|
|
{
|
|
char szPath[256];
|
|
|
|
GetCurrentDirectory( 256, szPath );
|
|
strcat( szPath, "\\DirectX" );
|
|
|
|
int ret = Z3D_SetupDirectX( NULL, "This program requires DirectX 8 or later\n"
|
|
"\nDo you want to install DirectX 8 ?", szPath );
|
|
|
|
if( DSETUPERR_SUCCESS_RESTART == ret )
|
|
{
|
|
if( IDNO == MessageBox( NULL,
|
|
"The Changes can have effect on your system after reboot.\n"
|
|
"Do you want to Restart System ?",
|
|
"Z3D", MB_ICONQUESTION | MB_YESNO ) )
|
|
{
|
|
return false;
|
|
}
|
|
|
|
OSVERSIONINFO osversion = { sizeof(OSVERSIONINFO), };
|
|
GetVersionEx( &osversion );
|
|
if( VER_PLATFORM_WIN32_NT == osversion.dwPlatformId ) // NT, 2000
|
|
{
|
|
HANDLE hToken;
|
|
if( !OpenProcessToken( GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken ) )
|
|
{
|
|
MessageBox(NULL, "Process Failed : OpenProcessToken", "Z3D", MB_ICONSTOP);
|
|
return false;
|
|
}
|
|
|
|
TOKEN_PRIVILEGES tkp;
|
|
|
|
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid);
|
|
|
|
tkp.PrivilegeCount = 1;
|
|
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
|
|
|
|
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0);
|
|
|
|
if (GetLastError() != ERROR_SUCCESS)
|
|
{
|
|
MessageBox(NULL,"Process Failed : AdjustTokenPrivileges", "Z3D", MB_ICONSTOP);
|
|
exit(-1);
|
|
}
|
|
|
|
if( !ExitWindowsEx(EWX_REBOOT | EWX_FORCE, 0) )
|
|
{
|
|
MessageBox(NULL,"Process Failed : ExitWindowsEx", "Z3D", MB_ICONSTOP);
|
|
return false;
|
|
}
|
|
}
|
|
else // 98/95
|
|
{
|
|
if( !ExitWindowsEx(EWX_REBOOT, 0) )
|
|
{
|
|
MessageBox(NULL,"Process Failed : ExitWindowsEx", "Z3D", MB_ICONSTOP);
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
else if( ret < 0 )
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
return TRUE;
|
|
} |