From 4af7546cf3a4ee7a46248a2501ee4973c3c02c28 Mon Sep 17 00:00:00 2001 From: blitz-research Date: Wed, 30 Jul 2014 11:55:08 +1200 Subject: [PATCH] Preparing for release! --- bbruntime_dll/bbruntime_dll.dsp | 2 +- blitzide/stdafx.cpp | 2 - gxruntime/std.h | 4 +- stdutil/shareprot.cpp | 150 -------------------------------- stdutil/shareprot.h | 17 ---- stdutil/stdutil.dsp | 8 -- stdutil/stdutil.h | 6 -- 7 files changed, 3 insertions(+), 186 deletions(-) delete mode 100644 stdutil/shareprot.cpp delete mode 100644 stdutil/shareprot.h diff --git a/bbruntime_dll/bbruntime_dll.dsp b/bbruntime_dll/bbruntime_dll.dsp index d5c6ca5..983a814 100644 --- a/bbruntime_dll/bbruntime_dll.dsp +++ b/bbruntime_dll/bbruntime_dll.dsp @@ -243,7 +243,7 @@ SOURCE=..\..\FreeImage241\Source\FreeImageLib\Release\FreeImage.lib # End Source File # Begin Source File -SOURCE=..\..\fmod375\fmodstatic.lib +SOURCE=..\..\fmodapi375win\api\lib\fmodvc.lib # End Source File # End Target # End Project diff --git a/blitzide/stdafx.cpp b/blitzide/stdafx.cpp index 5fb7613..b0e06dd 100644 --- a/blitzide/stdafx.cpp +++ b/blitzide/stdafx.cpp @@ -3,5 +3,3 @@ #include "../stdutil/stdutil.cpp" -#include "../stdutil/shareprot.cpp" - diff --git a/gxruntime/std.h b/gxruntime/std.h index 727cdad..157d843 100644 --- a/gxruntime/std.h +++ b/gxruntime/std.h @@ -2,6 +2,8 @@ #ifndef STD_H #define STD_H +#include "../../fmodapi375win/api/inc/fmod.h" + #include "../config/config.h" #include "../stdutil/stdutil.h" @@ -24,8 +26,6 @@ #include #include -#include "../../fmod375/fmod.h" - using namespace std; #endif \ No newline at end of file diff --git a/stdutil/shareprot.cpp b/stdutil/shareprot.cpp deleted file mode 100644 index f8cc822..0000000 --- a/stdutil/shareprot.cpp +++ /dev/null @@ -1,150 +0,0 @@ - -#ifdef DEMO - -#include -#include -#include -#include "shareprot.h" -#include "stdutil.h" - -using namespace std; - -#ifdef PRO //Blitz3D? -#define PRODUCT 0xce57abd1 -#else -#ifdef PLUS //BlitzPlus? -#define PRODUCT 0x7abd57ec -#else //Blitz2D! -#define PRODUCT 0x4feb9567 -#endif -#endif - -#define DEMO_RUNS 30 - -#define REG_MUNG (PRODUCT^0xce57abd7) -#define SYS_MUNG (PRODUCT^0x7adb57ec) - -#define REG_PRODUCT (PRODUCT^0x677fcb37) -#define SYS_PRODUCT (PRODUCT^0x4feba567) - -static void expired(){ - MessageBox( 0, - - "This demo verson has expired!\n\n" - "Please visit www.blitzbasic.com to buy the full version.", - - "Demo expired",MB_OK ); - - ExitProcess(0); -} - -static int tohex( int n ){ - return n<10 ? n+'0' : n+'a'-10; -} - -static string getSysFileName(){ - //get system file... - char dir[MAX_PATH]; - GetSystemDirectory( dir,MAX_PATH ); - char file[128]; - char *p=file,t=(char)0xbd; - *p++='\\'^t; - *p++='m'^t; - *p++='s'^t; - *p++='v'^t; - *p++='c'^t; - *p++=tohex((SYS_PRODUCT)&0xf)^t; - *p++=tohex((SYS_PRODUCT>>8)&0xf)^t; - *p++=tohex((SYS_PRODUCT>>16)&0xf)^t; - *p++=tohex((SYS_PRODUCT>>24)&0xf)^t; - *p++='.'^t; - *p++='s'^t; - *p++='y'^t; - *p++='s'^t; - *p++=0; - for( p=file;*p;++p ) *p^=t; - return string( dir )+string( file ); -} - -static string getRegKeyName(){ - return string( "software\\Brlconfig\\"+itoa(REG_PRODUCT) ); -} - -static bool setCount( int cnt ){ - - HKEY hkey; - if( RegCreateKey( HKEY_LOCAL_MACHINE,getRegKeyName().c_str(),&hkey )==ERROR_SUCCESS ){ - int val=cnt^REG_MUNG; - LONG n=RegSetValueEx( hkey,0,0,REG_DWORD,(const BYTE*)&val,4 ); - RegCloseKey( hkey ); - if( n!=ERROR_SUCCESS ) return false; - }else{ - return false; - } - - if( FILE *f=fopen( getSysFileName().c_str(),"wb" ) ){ - int val=cnt^SYS_MUNG; - int n=fwrite( &val,4,1,f ); - fclose(f); - if( n!=1 ) return false; - }else{ - return false; - } - - return true; -} - -static int getCount(){ - - int reg_cnt=DEMO_RUNS+1,sys_cnt=DEMO_RUNS+1; - - HKEY hkey; - if( RegOpenKey( HKEY_LOCAL_MACHINE,getRegKeyName().c_str(),&hkey )==ERROR_SUCCESS ){ - int ty=0,sz=4; - RegQueryValueEx( hkey,0,0,(DWORD*)&ty,(BYTE*)®_cnt,(DWORD*)&sz ); - if( ty!=REG_DWORD ) reg_cnt=0; - else{ - reg_cnt^=REG_MUNG; - if( reg_cnt<0 || reg_cnt>DEMO_RUNS ) reg_cnt=0; - } - RegCloseKey( hkey ); - } - - if( FILE *f=fopen( getSysFileName().c_str(),"rb" ) ){ - if( fread( &sys_cnt,4,1,f )!=1 ) sys_cnt=0; - else{ - sys_cnt^=SYS_MUNG; - if( sys_cnt<0 || sys_cnt>DEMO_RUNS ) sys_cnt=0; - } - fclose(f); - } - - return sys_cnt==reg_cnt ? sys_cnt : 0; -} - -void shareProtStart(){ - - if( int cnt=getCount() ) setCount( cnt-1 ); -} - -int shareProtCheck(){ - - return getCount(); -} - -void shareProtAssert(){ - - if( !getCount() ) shareProtJump( expired ); -} - -_declspec(naked) void _stdcall shareProtJump( void(*target)() ){ - _asm{ - mov eax,4[esp] - mov [esp],0x12345678 ;return - mov 4[esp],0x12345678 ;param - mov 8[esp],0x12345678 ;more... - call eax - } -} - -#endif diff --git a/stdutil/shareprot.h b/stdutil/shareprot.h deleted file mode 100644 index bd7416b..0000000 --- a/stdutil/shareprot.h +++ /dev/null @@ -1,17 +0,0 @@ - -#ifndef SHAREPROT_H -#define SHAREPROT_H - -//bump counter -void shareProtStart(); - -//return counter -int shareProtCheck(); - -//error if counter==0 -void shareProtAssert(); - -//clean stack then jump! Never returns! -void _stdcall shareProtJump( void(*target)() ); - -#endif \ No newline at end of file diff --git a/stdutil/stdutil.dsp b/stdutil/stdutil.dsp index 273c356..ca4eca4 100644 --- a/stdutil/stdutil.dsp +++ b/stdutil/stdutil.dsp @@ -192,14 +192,6 @@ LIB32=link.exe -lib # Name "stdutil - Win32 Blitz3DDemo" # Begin Source File -SOURCE=.\shareprot.cpp -# End Source File -# Begin Source File - -SOURCE=.\shareprot.h -# End Source File -# Begin Source File - SOURCE=.\stdutil.cpp # End Source File # Begin Source File diff --git a/stdutil/stdutil.h b/stdutil/stdutil.h index 4e80678..b5d94d1 100644 --- a/stdutil/stdutil.h +++ b/stdutil/stdutil.h @@ -6,12 +6,6 @@ #include "../config/config.h" -/* -#ifdef DEMO -#include "shareprot.h" -#endif -*/ - #include #include