Register
Site Login
Site Search
Forums
Advertisement
Welcome to PocketMatrix. PocketMatrix is dedicated to providing the best online community for mobile device developers and enthusiests. What's new?

What is "__sequrity_cookie" & "__sequrity


What is "__sequrity_cookie" & "__sequrity

Postby Nomad » Nov 5, 2006 @ 9:28pm

Hi!

When I use following code:

zipFile.resolveFile(&imageFile, pBuffer)

where pBuffer: WCHAR pBuffer[100];

I get "Unresolved external symbol" linker error with subject symbols (__sequrity_cookie & __sequrity_check_cookie)

Is that means that I can't pass to resolveFile() non constant buffer?
Nomad
pm Member
 
Posts: 76
Joined: Oct 28, 2006 @ 8:21pm
Location: Ukraine, Kiev


Postby Nomad » Nov 5, 2006 @ 9:53pm

Strange, but when I changed static buffer to dynamic ( WCHAR* pBuffer = new WCHAR[100]; ) code was linked normally without error.

Can somebody explain why I can't use static buffer in Pocket PC version? This is not critical but just interasting.
Nomad
pm Member
 
Posts: 76
Joined: Oct 28, 2006 @ 8:21pm
Location: Ukraine, Kiev


Postby Matias » Nov 5, 2006 @ 11:19pm

About what PocketPC version are you talking about, 2002, 2003, 2005? Compiling for emulator or for the pocket pc?

I cannot reproduce your error. Can you post the entire code, please?

Where is declared the variable, where is initialized, where you call the resolveFile method, etc
Matias Saguir - GledPlay Lead Developer
User avatar
Matias
pm Member
 
Posts: 20
Joined: Oct 11, 2006 @ 9:57pm


Postby Nomad » Nov 5, 2006 @ 11:38pm

In Visual Studio 2005 I've created smart device project for Pocket PC 2003.
Linking using lib in folder "VS2005 - PPC 2003"

following code is enough to make this error

Code: Select all









10 
File     imageFile;
HRESULT  returnCode;
WCHAR    pBuffer[100];

for( DWORD i=0; i<Number; i++ )
{
    swprintf( pBuffer, "%d.png", i+1 );
    zipFile.resolveFile(&imageFile, pBuffer);
    pSurfaces[ i ].create( &imageFile );
}
10 lines; 1 keywds; 3 nums; 34 ops; 1 strs; 0 coms    Syntactic Coloring v0.4 - Dan East  


In XP project this error message is not occured and all linked ok.
Nomad
pm Member
 
Posts: 76
Joined: Oct 28, 2006 @ 8:21pm
Location: Ukraine, Kiev


Postby Nomad » Nov 5, 2006 @ 11:55pm

Ha! :D

I've search in MSDN and found an interasting article "Compiler Security Checks In Depth".

It said that in VS.net when compiling with /GS compile-time flag, compiler use special mechanism to avoid buffer-overrun, to make hacker attacks using this method impossible.

But, probably, in mine situation there was some problems in linking this mechanism due to some linker setings. When I write in compiler setting /GS-, this error message disappears.

Interasting thing, that I couldn't find /GS flag in compiler settings, so I think it is used by compiler by default in all projects. Anyway explicintly set /GS- resolves this situation.
Nomad
pm Member
 
Posts: 76
Joined: Oct 28, 2006 @ 8:21pm
Location: Ukraine, Kiev


Postby Matias » Nov 6, 2006 @ 1:30am

That´s right, you find it first :D,

The buffer security check works using a cookie for any function that access local variables by reference. The __secutiry_check_cookie is a function that its added by the compiler before the return of this function anytime this situation appear.

The error link appears because, in order to use this secutiry check, you must first initialize the cookie by calling some function we are not using in our InitApplication (We are not using the Secutiry Buffer Check in GledPlay) and I guess it is not added in the Visual Studio's "Create smart device project for Pocket PC 2003"

Also, as you say, the compiler is using by default this check activated for PPC, and that´s why the error appears in PPC and not in PC.

If you like the subject, The Secutiry Buffer Check is described in this book; "Reversing: Secrets of Reverse Engineering" written by Eldad Eilam. Maybe you find it interesting.

Best Regards
Matias Saguir - GledPlay Lead Developer
User avatar
Matias
pm Member
 
Posts: 20
Joined: Oct 11, 2006 @ 9:57pm


Return to GledPlay


Sort


Forum Description

Game Engine for Embedded Devices. Simple, complete, and powerful. Focused on the game.

Moderators:

Matias, Sergio

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron