Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1912
  • Last Modified:

Access violation

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
lwinkenb
Asked:
lwinkenb
  • 2
1 Solution
 
jkrCommented:
Have you used

InitializeCriticalSection (  g_criticalSection);

before using it? If not, this would explain the problem...
0
 
lwinkenbAuthor Commented:
argh, I knew it was something simple.
Thanks jkr.
0
 
jkrCommented:
You're most welcome :o)
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now