Re: InitializeCriticalSection code in kernel



Hello All,

I am sorry but I was out of action for a long time now due to an
injury.

We did a small exercise going by the discussion we are having.

We wrote a small application in WinCE 5.0. The application does nothing
more than just declaring a variable of the type CRITICAL_SECTION and
then we put a small loop which keeps calling the
IntialiseCriticalSection repeatedly. After calling the same for about
~422291 times the message box shows "Not enough memory". The OS does
not respond after this.

I think this exercise brings out the purpose of my initial mail.
I am copying the code at the bottom.

Regards
Yash

==================================================
// critical.cpp : Defines the entry point for the application.
//

#include "stdafx.h"
#include "critical.h"
#include <commctrl.h>

void createcritical();

CRITICAL_SECTION m_Lock;

int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
createcritical();
return 0;
}


void createcritical()
{
UINT i=0;
do
{
InitializeCriticalSection(&m_Lock);
RETAILMSG(1,(TEXT("i=%u\n"),i));
}while(++i);
}
==================================================


Sue Loh [MS] wrote:
It isn't really clear to me what you mean, that anyone can crash the system
using IPCs. Could you get more specific? Generally our goal is that low
privilege apps can crash themselves but nobody else, while high privilege
code could probably bring down the system.

Sue
sloh@xxxxxxxxxxxxx (remove "online" from reply-to address)
http://blogs.msdn.com/ce_base/
_____________________________________________________________
This posting is provided "AS IS" with no warranties, and confers no rights.
_____________________________________________________________

.



Relevant Pages

  • Ullrichsim; Was: Constructibility of X -> X^2 bijection
    ... I erred in calling this a well-ordering, as I acknowledge in a later post. ... An actual _exercise_ should not ask ... But using exactly one comma there would be definitely ... Spanier was not competent to write tests. ...
    (sci.math)
  • Re: Inconsistent Program Results
    ... The following program is my solution to an exercise to take an input, ... strip the first word, and output the rest. ... declaring main with a return type of void is a gross error. ...
    (comp.lang.c)
  • race condition during termination process
    ... Have you ever heard about lupg's multithread tutorials? ... There are 2 exercise at the last part of chapter 7.7(Threads ... int request_index; ...
    (comp.programming.threads)
  • Re: realloc(): invalid next size
    ... void *s2=NULL; ... but a size zero is. ... it's based on compiler secrets. ... I understand this is nothing more than an exercise in second ...
    (comp.lang.c)
  • Inconsistent Program Results
    ... having fun with strings & pointers at the moment! ... The following program is my solution to an exercise to take an input, ... strip the first word, and output the rest. ... void rdinpt; ...
    (comp.lang.c)