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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:06:26+00:00 2026-05-25T13:06:26+00:00

How do I enable Better Performance on an External USB HD programatically in C/C++.

  • 0

How do I enable “Better Performance” on an External USB HD programatically in C/C++.

Specifically I am talking about the device properties pane in the control panel in Microsoft Windows. That enables a form of OS level write caching.

Better Performance Policy

  • 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-25T13:06:27+00:00Added an answer on May 25, 2026 at 1:06 pm

    This link Provided by Alex K. is my accepted answer: It deals with the IOCTL_DISK_SET_CACHE_INFORMATION DeviceIoControl()

    http://blogs.msdn.com/b/dhawan/archive/2009/10/05/enable-or-disable-enable-write-caching-on-disk-behavior-on-disk.aspx

    #define _WIN32_WINNT 0x0503
    
    #include <windows.h>
    
    DISK_CACHE_INFORMATION info;
    DISK_CACHE_INFORMATION rinfo;
    
    
    void main(void)
    {
        DWORD rr;
        HANDLE hDevice;
        DWORD err;
        DWORD returned;
    
        hDevice = CreateFile("\\\\.\\C:", // drive to open
                    GENERIC_READ | GENERIC_WRITE,
                    FILE_SHARE_WRITE | FILE_SHARE_READ, 
                    // share mode
                    NULL, // default security attributes
                    OPEN_EXISTING, // disposition
                    FILE_ATTRIBUTE_SYSTEM, // file attributes
                    NULL); // do not copy file attributes
        if(hDevice==INVALID_HANDLE_VALUE)
        {
            return;
        }
    
        rr = DeviceIoControl(hDevice,IOCTL_DISK_GET_CACHE_INFORMATION,NULL,
                            0,(LPVOID)&info,(DWORD)sizeof(info),(LPDWORD)&returned,    (LPOVERLAPPED)NULL);
        if (!rr)
        {
            err = GetLastError();
            return;
        }
    
        info.WriteCacheEnabled = true;
        info.ReadCacheEnabled = false;
        info.DisablePrefetchTransferLength = 1;
    
        rr = DeviceIoControl(hDevice,IOCTL_DISK_SET_CACHE_INFORMATION,(LPVOID)&info,(DWORD)sizeof(info),
                            NULL,0,(LPDWORD)&returned,(LPOVERLAPPED)NULL);
        if (!rr)
        {
            err = GetLastError();
            return;
        }
    
        rr = DeviceIoControl(hDevice,IOCTL_DISK_GET_CACHE_INFORMATION,NULL,0,
                            (LPVOID)&rinfo,(DWORD)sizeof(rinfo),(LPDWORD)&returned,(LPOVERLAPPED)NULL);
        if (!rr)
        {
            err = GetLastError();
            return;
        }
    
        CloseHandle(hDevice);
    }
    

    Old Information:
    Windows 2K did contain a “Power Protected” Write Cache Option, but it was never carried over to Windows XP. Which makes a comment about using Dskcache.exe invalid. Was “Power Protected Mode” ever put back into e.g. Windows Vista? I do not know.

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

Sidebar

Related Questions

How do I enable external access to MySQL Server? I can connect locally but
Is it possible to enable a second monitor programatically and extend the Windows Desktop
Is it better for performance to set EnableViewState to false for all pages and
Feeling like less-code-is-better-code so wanted to optimize how to enable several items at the
I want to enable an user to be able to communicate with other users
I am trying to enable Full-text indexing in SQL Server 2005 Express. I am
I need to enable/disable completely network interfaces from a script in Windows XP. I'm
I would like to enable/disable some code based on a custom solution configuration I
I'd like to enable/disable some other controls based on how many items are in
In our application we enable users to print pages. We do this by supplying

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.