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 362577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:15:37+00:00 2026-05-12T13:15:37+00:00

The task that I’m trying to handle is to create a set of wrappers

  • 0

The task that I’m trying to handle is to create a set of wrappers around WINAPI to handle various file modifications for files with deep paths in Windows.

Currently, I copy files using WINAPI call prefixed with “\\?\” as suggested here. After copying the file, I’m using the file time metadata (created, accessed, modified) from the original file and setting the time on the destination file. I’m having a problem when I try to apply this logic to a readonly file.

This is what I’ve attempted so far:

  1. Copy the file.
  2. Remove the ReadOnly flag from the destination using SetFileAttributes after calling GetFileAttributes.
  3. GetFileTime(original)
  4. SetFileTime(destination) (with original file times)
  5. Apply the readonly flag again.

The problem with this is that the file modified time gets updated after reapplying the readonly flag. Is there a way to do this perserving all the metadata?

  • 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-12T13:15:37+00:00Added an answer on May 12, 2026 at 1:15 pm

    I would try opening the file not for GENERIC_WRITE, but for FILE_WRITE_ATTRIBUTES, to set the file time, and expect that opening is granted even if the file has the read-only attribute set.

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

Sidebar

Related Questions

I have a Symfony task that generates some files calls exec to a jar
i got a task that ask me to create a page, which can display
I have a msbuild task that outputs to a file. Now I want to
I have a rake task that uploads a list of files via ftp. Copying
I have a background task that imports files into a database. I want the
I have an Ant task that takes a wsdl file and should auto generate
I have an Ant task that builds an executable JAR file, runs some JUnit
I have a rake task that connects to an ftp server, downloads a file,
I have Async Task that must write folder Files from assets to folder on
I wrote this rake task that enables me to read a csv file from

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.