TryEnterCritical (was Re: libkernel32a.lib (fwd))

Paul Garceau
Tue Sep 15 19:33:00 GMT 1998

Hi folks,

	I don't consider myself an expert on Win32, however, I did manage to 
find some things out.  Follows are some thoughts/info on 'TryEnterCritical':

On 14 Sep 98, at 23:20, the Illustrious Mumit Khan wrote:

> On Sat, 12 Sep 1998, Ben Elliston wrote:
> > It's well documented that the ``TryEnterCriticalSection'' API function
> > is not available on Win32s and Win95/98.  I don't know if that means
> > that the function doesn't exist in any library, or if the function
> > should exist in a library, but be implemented to return some error code
> > at runtime.

	After checking my own NT4 directories (.dlls and .a files) I am inclined 
to believe the former.  Perhaps it is my own "worst case scenario" 

	At any rate, I show that, under NT4/SP3, that the function exists in the 
kernel32.dll as well as the old MS NT4 mapi32 implementation (pre-SP3) and 
doesn't exist in the collection of .a files, including libkernel32.a.

	The implementation of 'TryEnterCritical', judging by the dates of the .dlls 
that the function was actually found in, was moved by MS from the old 
mapi32 implementation (not necessarily a Win32 API implementation) into 
the kernel32.dll.  MS has always been way behind when it comes to 
implementing traditional Unix APIs, such as Mapi...

> >  I believe it is the latter.  In which case, can anyone
> > explain why this function is missing from the kernel32 stub library?

	Apparently, judging from what Ben has said above, Win95/98 and 
Win3.11 (win32s) kernel implementation are sufficiently different that MS had 
to use some other form of 'TryEnterCritical'.  If 'TryEnterCritical' exists in any 
form under non-NT4 Win32 systems, it is probably called something else 
entirely.  At this point, there is every reason to believe that "TryEnterCritical" 
function is only available with(via) the MS Mapi API update for all pre-NT4 
Win32 system implementations.

As to why 'TryEnterCritical'  is not part of the libkernel32.a file --

	I am working with EGCS-1.0.2-Mingw32.  I am inclined to believe, and 
Mumit can correct me on this, that EGCS-1.0.2 or Mingw32 (Colin?) or both 
were natively developed under Win95, which, afaik, does _not include_  a 
native implementation of Mapi.

	This also seems to indicate that the function 'TryEnterCritical' doesn't 
exist even under Cygwin32 except possibly as a Unix call.  Again, I am not 
using Cygwin32, so I can't directly address this.

	I did find, under the last release of Win32s, several references to 



	Other Win32s .dlls which are indicated to have "CriticalSection" 
somewhere within are:

		(WFW3.11->)mfcans32.dll, msvcrt20.dll, kpsys32.dll, sprof32.dll, 
wininet.dll, oleaut32.dll, (Win32s ->) crtdll.dll, riched32.dll and w32scomb.dll

	I hope this helps.


		Paul G.

	Ben, you might want to check the MS Platform SDK update for your 
Win32 development system, it is likely you will find 'TryEnterCritical' as part 
of the Mapi API, if it exists at all.

	Hope this helps.


		Paul G.

Information Systems Consultant
NewDawn Productions
For help on using this list (especially unsubscribing), send a message to
"" with one line of text: "help".

More information about the Cygwin mailing list