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

  • Home
  • SEARCH
  • 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 7674367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:43:20+00:00 2026-05-31T16:43:20+00:00

_SH_DENYWR denies any other attempt to open a file with write permissions (share violation)

  • 0

_SH_DENYWR denies any other attempt to open a file with write permissions (share violation)
_SH_SECURE Sets secure mode (shared read, exclusive write access)

The _SH_SECURE seems to be newer, based on the fact that the docs seem to gloss over it or omit it depending on where you look. There’s almost no info on the ‘net that I could find on it.

How are those any different?

  • 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-05-31T16:43:21+00:00Added an answer on May 31, 2026 at 4:43 pm

    The behavior of _SH_SECURE depends on the access requested in the mode argument to _fsopen()/_wfsopen(). If only read access is requested, then _SH_SECURE maps to FILE_SHARE_READ. Otherwise, it maps to 0 (exclusive access).

    Contrast _SH_DENYWR, which always maps to FILE_SHARE_READ.

    The relevant part of the CRT source code (lines 269-301 of open.c in Visual Studio 2010) is as follows:

    /*
     * decode sharing flags
     */
    switch ( shflag ) {
    
        case _SH_DENYRW:        /* exclusive access */
            fileshare = 0L;
            break;
    
        case _SH_DENYWR:        /* share read access */
            fileshare = FILE_SHARE_READ;
            break;
    
        case _SH_DENYRD:        /* share write access */
            fileshare = FILE_SHARE_WRITE;
            break;
    
        case _SH_DENYNO:        /* share read and write access */
            fileshare = FILE_SHARE_READ | FILE_SHARE_WRITE;
            break;
    
        case _SH_SECURE:       /* share read access only if read-only */
            if (fileaccess == GENERIC_READ)
                fileshare = FILE_SHARE_READ;
            else
                fileshare = 0L;
            break;
    
        default:                /* error, bad shflag */
            _doserrno = 0L; /* not an OS error */
            *pfh = -1;
            _VALIDATE_RETURN_ERRCODE(( "Invalid sharing flag" , 0 ), EINVAL);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to write a shell script ( .sh file) to get a given
I have a .sh script that automounts any usb device that is plugged in.
make /bin/sh /Users/myusername/Downloads/php-5.3.5/ext/mssql/libtool --mode=compile cc -I. -I/Users/myusername/Downloads/php-5.3.5/ext/mssql -DPHP_ATOM_INC -I/Users/myusername/Downloads/php-5.3.5/ext/mssql/include -I/Users/myusername/Downloads/php-5.3.5/ext/mssql/main -I/Users/myusername/Downloads/php-5.3.5/ext/mssql -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM
I'm creating an sh script file to move files from a folder to another,
I have a sh/bash script that needs to call a batch file with parameters
I have a shell script run.sh which is executing a jar file. #!/bin/bash $JAVA_HOME/bin/java
#!/bin/sh files = 'ls /myDir/myDir2/myDir3/' for file in $files do echo $file java myProg
In sh-mode in Emacs, I was looking for a way to execute a shell
My sample file traptest.sh: #!/bin/bash trap 'echo trapped' TERM while : do sleep 1000
I am working on some legacy code which opens a file and adds binary

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.