Encryption problem

01/25/2014 10:53 max982#1
Hello, i had an idea of making my own ecnryption system, and it works fine, then i had an other idea of making it work in parralel with the default .res files so any player can use an client to play and custom contenent will go into encrypted files.

I made this system to work like this:

The old flyff's Scan thingy -> If the file is encrypted -> IsEnc = True;
Else use the old .res encryption key or something

The error i'm having is
PHP Code:
20141/22   00:39:26    rCnt=1

Neuz
.exe caused an EXCEPTION_ACCESS_VIOLATION in module Neuz.exe at 0023:0079AABACScript::PreScan()+0842 byte(s), c:\users\moncef\desktop\server files\source\program\_common\script.cppline 0382+0006 byte(s)

 - 
Registers

EAX
=0018DB08  EBX=7FFDE000  ECX=015C6000  EDX=0018DB08  ESI=00000000
EDI
=75F6B756  EBP=0018DAFC  ESP=0018DA84  EIP=0079AABA  FLG=00210216
CS
=0023   DS=002B  SS=002B  ES=002B   FS=0053  GS=002B

0023
:0079AABA Neuz.exeCScript::PreScan()+0842 byte(s)
0023:006E221F Neuz.exeCProject::LoadDefines()+0287 byte(s)
0023:006E225F Neuz.exeCProject::LoadPreFiles()+0015 byte(s)
0023:00473B7E Neuz.exeCNeuzApp::BeginLoadThread()+0030 byte(s)
0023:00473BEA Neuz.exeCNeuzApp::InitDeviceObjects()+0058 byte(s)
0023:0049382E Neuz.exeCD3DApplication::Initialize3DEnvironment()+2030 byte(s)
0023:0049205A Neuz.exeCD3DApplication::Create()+0890 byte(s)
0023:00479BA8 Neuz.exeWinMain()+0392 byte(s)
0023:009482F2 Neuz.exeWinMainCRTStartup()+0388 byte(s)
0023:75F6495D KERNEL32.DLLBaseThreadInitThunk()+0014 byte(s)
0023:777898EE ntdll.dllRtlInitializeExceptionChain()+0132 byte(s)
0023:777898C4 ntdll.dllRtlInitializeExceptionChain()+0090 byte(s
Any help suggested ?
01/25/2014 17:12 Mognakor#2
c:\users\moncef\desktop\server files\source\program\_common\script.cpp, line 0382+0006 byte(s)
01/25/2014 17:49 max982#3
Quote:
Originally Posted by Mognakor View Post
c:\users\moncef\desktop\server files\source\program\_common\script.cpp, line 0382+0006 byte(s)
Oh seriously? You think i'm too idiot to no go there? Go back from where you came, you have no utility here.
01/25/2014 19:34 WurstbrotQT#4
Quote:
Originally Posted by max982 View Post
Oh seriously? You think i'm too idiot to no go there? Go back from where you came, you have no utility here.
So why do you post those errors, if you know what do do there? If you want us to help you you have to post some code otherwise it's not possible.
01/25/2014 23:34 max982#5
Quote:
Originally Posted by WurstbrotQT View Post
So why do you post those errors, if you know what do do there? If you want us to help you you have to post some code otherwise it's not possible.
Oh okay, didn't know about posting the code,
So yeah, here it is:

PHP Code:
if( CompareExtc_file.name".res" ) )
            {
                
IsNewEnc FALSE;
                
strcatszPathc_file.name );
                
AddResourceszPath  );
                ::
Error_T"File %d, Is %d" ), c_file.nameIsNewEnc );
            } else if( 
CompareExtc_file.name".adi" ) )
            {
                
IsNewEnc TRUE;
                
strcatszPathc_file.name );
                
AddResourceszPath  );
                ::
Error_T"File %d, Is %d" ), c_file.nameIsNewEnc );
                
AfxMessageBox(c_file.name);
            } 
And then:

PHP Code:
        if(IsNewEnc == TRUE)
        {    
            for( 
int i 0nFileHeaderSizei++ )
            {
                
pHeader[i] = DecryptionADIbyEncryptionKeypCryptHeader] );
            }
        } else
        {
            for( 
int i 0nFileHeaderSizei++ )
            {
                
pHeader[i] = DecryptionbyEncryptionKeypCryptHeader] );
            }
        } 
And it's the same for the others
01/26/2014 00:11 WurstbrotQT#6
Maybe it crashes because you try to print a string array as a decimal value?
01/26/2014 11:15 max982#7
Quote:
Originally Posted by WurstbrotQT View Post
Maybe it crashes because you try to print a string array as a decimal value?
I don't think so, what i did was to multiply the Encryptionkey with a coef so that it does some encryption, when i tried it without the .res, it works fine with the .adi files, but then i had the idea of making it work in parralel, witch i failed at.

So i don't think it's a decimal problem or something like that.
01/26/2014 14:05 Mognakor#8
No idea how CompareExt works, but the usual string-comparism returns true (different from 0) if the string is not equal and false (0) if the strings are equal.

sincerely 'the useless idiot'

P.S.: Your first part of code generates 3 possible states but those are only distinguished by 2 possible states, if you read neither a .res nor .adi file you are gonna experience unexpected or even undefined behavior.