Solved

Access violation

Posted on 2003-11-02
3
1,773 Views
Last Modified: 2012-05-04
I have a global CRITICAL_SECTION object, but when I try to use EnterCriticalSection() with it, I get an access violation.

CRITICAL_SECTION g_criticalSection;
...

//Then later on in a global function I have
EnterCriticalSection(&g_criticalSection);  // Access violation here
memset(g_szClipboard,0,sizeof(g_szClipboard));
LeaveCriticalSection(&g_criticalSection);

What could be the problem?
0
Comment
Question by:lwinkenb
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 9666663
Have you used

InitializeCriticalSection (  g_criticalSection);

before using it? If not, this would explain the problem...
0
 
LVL 5

Author Comment

by:lwinkenb
ID: 9666683
argh, I knew it was something simple.
Thanks jkr.
0
 
LVL 86

Expert Comment

by:jkr
ID: 9666693
You're most welcome :o)
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now