Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8268075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:45:04+00:00 2026-06-08T05:45:04+00:00

May be this is stupid question for you .. but it doesn’t work for

  • 0

May be this is stupid question for you .. but it doesn’t work for me! (New to WinRT .. may be windows too!) Just trying to create semaphore and trying to acquire that’s it .. nothing fancy. But it fails with WAIT_FAILED: 5 (Access denied)

void MainPage::simple_Sema_test1()
{

    HANDLE p_sema;
    DWORD ret, err;
    p_sema = CreateSemaphoreEx(NULL, 1, MAX_LIMIT, L"sema1", 0, SEMAPHORE_MODIFY_STATE);
    if(p_sema == NULL)
        print_on_textbox("CreateSemaphoreEx Failed!\n");
    ret = WaitForSingleObjectEx(p_sema, 1000, TRUE);
    switch(ret){
    case WAIT_ABANDONED:
        print_on_textbox("WAIT_ABANDONED\n");
    case WAIT_IO_COMPLETION:
        print_on_textbox("WAIT_IO_COMPLETION\n");
    case WAIT_OBJECT_0:
        print_on_textbox("WAIT_OBJECT_0\n");
    case WAIT_TIMEOUT:
        print_on_textbox("WAIT_TIMEOUT\n");
    case WAIT_FAILED:
        print_on_textbox("WAIT_FAILED: " + (GetLastError()).ToString());
}

Edit <<< (Partially solved)
Create Semaphore with SEMAPHORE_ALL_ACCESS

i.e.

*sema = CreateSemaphoreEx(NULL, initial, MAX_LIMIT, L"sema1", 0, SEMAPHORE_ALL_ACCESS);

If anyone knows why it didn’t work with modify access then please explain!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T05:45:06+00:00Added an answer on June 8, 2026 at 5:45 am

    To wait on a synchronization object, you must have SYNCHRONIZE access rights:

    SYNCHRONIZE: The right to use the object for synchronization. This enables a thread to wait until the object is in the signaled state.

    The SEMAPHORE_ALL_ACCESS value includes the SYNCHRONIZE flag.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This may sound like a stupid question but I'm a beginner not just to
This may be a stupid question but im just starting to learn Rail thats
This may be a stupid question, but I'm trying to replicate a customer's OpenLDAP
This may be a stupid question but I can't help asking, just to verify.
Ok...I am new to rails so this may be a stupid question but need
I'm trying to studdy some performace things... this question may sound stupid, but I'll
This may be a stupid question but I have a code with the following
This may sound like a stupid question but I can't seem to find an
This may sounds like a stupid question but can't find anything on google, probably
this may be a stupid question but when I add a reference to my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.