I had some problems with chkesp when implementing a dll. I actually created a stub function in the header to override this problem. I am still having underlying problems.
Well I have determined with the help of some associates, collegues and naborly netizens that the crux of the following problems lie in poorly solved solution to problem #2. The _chkesp() function whose job it is to make sure that the stack doesnt get corrupted. Probably this is a result of improper calling convention somewhere.
Any Ideas?
Asher
The problems that I have been running into are these:
PROBLEM 1 :
c:\program files\microsoft visual studio\vc98\include\basetsd.h(41) : see declaration of 'UINT32'
c:\projects\edmutils\addunzip.h(26) : error C2371: 'INT32' : redefinition different basic types
SOLUTION 1 : commented definitions out of addzip.h and addunzip.h NOW no longer get that compiler message
PROBLEM 2 : (what does chkesp do?)
Debug Error!
Program C:\PROJECTS\EDMUTILS\DEBUG\EDMUTILS.EXE
MODULE:
FILE: I386\CHKESP.C
THE VALUE OF ESP WAS NOT PROPERLY SAVED ACROSS A FUNCTION CALL.
THIS IS USUALLY A RESULT OF CALLING A FUCNTION DECLARED WITH
ONE CALLING CONVENTION WITH A FUNCTION POINTER DECLARED WITH
A DIFFERENT CALLING CONVENTION.
(PRESS RETRY TO DEBUG THE APP)
ABORT RETRY IGNORE
SOLUTION 2: CREATED A TINY INLINE FUNCTION STUB IN THE addzip.h file void _chkesp(void){}.
Now I no longer get the runtime error.
chkesp checks the stack pointer before a function returns, as far as I know. If you call
functions using inline assembly, you must pay attention to calling convention (especially
who's responsible for clearing the stack caller/callee)
PROBLEM 3: NOW I GET AN ACCESS VIOLATION AT ccccccd3 (WIN32ZIPPER executed an invalid instruction in
module <unknown> at 00de:ccccccd1.)AFTER THE APPLICATION TERMINATES.
ALSO THERE DO NOT APPEAR TO BE ANY ZIP FILES CREATED. My application is just a generic
Windows32 Application, no window thus there is no hwnd. Here is the extent of it.
#include "stdafx.h"
#include <io.h>
#include "addzip.h"
#include "addunzip.h"
#include "errno.h"
#define TRUE 1
#define FALSE 0
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
short I;
char cWinDir[256];
char cFiles[256];
char *cArchive = "TEST32.ZIP";
GetWindowsDirectory((LPSTR)cWinDir, sizeof(cWinDir));
wsprintf(cFiles, "%s\\*.INI", cWinDir);
addZIP_Initialise();
addUNZIP_Initialise();
addZIP_ArchiveName(cArchive);
addZIP_Include(cFiles);
I = addZIP_GetLastError();
strerror(errno);
// I = addZIP_Recurse(TRUE); //was getting an error here for some reason
addZIP_SetCompressionLevel(0x02);
I = addZIP(); //now returns a negative number...that is not good.
unlink(cArchive);
return 1;
}
SOLUTION 3: TO BE DETERMINED.
Actually I have since scrapped those libraries finding them a bit difficult to intigrage into my application. I have taken an easier route and am using different libraries. Thanks for your input and attention.
Asher
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.