Inhalt
English (United Kingdom)French (Fr)Deutsch (DE-CH-AT)
Suchen
Login
Wer ist online?
Wir haben 151 Gäste online
Navigation
Home Quellkode C/C++ NTFS compression
Aktuell
Featured Articles
Joomla 1.5 Featured Articles
Navigation
Home Quellkode C/C++ NTFS compression
English (United Kingdom)French (Fr)Deutsch (DE-CH-AT)
NTFS compression E-Mail
Benutzerbewertung: / 7
SchwachPerfekt 
Source Code - C/C++
Geschrieben von: Thomas   
Sonntag, 01. Februar 2009 um 22:12 Uhr

 

A function to compress a file by utilising NTFS's compression feature.

 

Open CompressNTFS.c
 

CompressNTFS.c:

 
#include <windows.h>
 
BOOL CompressFileNTFSEx (const TCHAR *tcFileName, USHORT usState)
{  // Compress or uncompress the given file.
  //
  //  usState can be:
  //  0 = COMPRESSION_FORMAT_NONE
  //  1 = COMPRESSION_FORMAT_DEFAULT
  //  2 = COMPRESSION_FORMAT_LZNT1
  //
  //  Returns TRUE if successful, FALSE if an error occurred.
  //
 
  HANDLE    hFile;
  DWORD    dwBytesReturned;
  BOOL    bResult;
 
  //return FALSE;
 
  hFile = CreateFile (tcFileName,
          GENERIC_READ | GENERIC_WRITE,
          FILE_SHARE_DELETE + FILE_SHARE_READ + FILE_SHARE_WRITE,
          NULL,
          OPEN_EXISTING,
          FILE_ATTRIBUTE_NORMAL + FILE_FLAG_SEQUENTIAL_SCAN,
          NULL);
  if (hFile == INVALID_HANDLE_VALUE)
    return FALSE;
  bResult = DeviceIoControl (hFile,      // Handle to file or directory
            FSCTL_SET_COMPRESSION,  // dwIoControlCode
            &usState,        // Input buffer
            sizeof (USHORT),    // Size of input buffer
            NULL,          // lpOutBuffer
            0,            // nOutBufferSize
            &dwBytesReturned,    // Number of bytes returned
            NULL          // OVERLAPPED structure
            );
  if (!CloseHandle (hFile))
    return FALSE;
  return (bResult);
}
 
BOOL CompressFileNTFS (const TCHAR *tcFileName)
{
  return (CompressFileNTFSEx (tcFileName, COMPRESSION_FORMAT_DEFAULT));
}
 
BOOL UnCompressFileNTFS (const TCHAR *tcFileName)
{
  return (CompressFileNTFSEx (tcFileName, COMPRESSION_FORMAT_NONE));
}
 
Open CompressNTFS.c

 

Open CompressNTFS.h
 

CompressNTFS.h:

 
#ifndef __Compress_NTFS_included
#define __Compress_NTFS_included
 
BOOL CompressFileNTFSEx (const TCHAR *tcFileName, USHORT usState);
BOOL CompressFileNTFS (const TCHAR *tcFileName);
BOOL UnCompressFileNTFS (const TCHAR *tcFileName);
 
#endif
 
Open CompressNTFS.h
 

 

Zuletzt aktualisiert am Sonntag, 08. Februar 2009 um 18:56 Uhr
 
Du musst dich anmelden oder registrieren, um einen Kommentar zu schreiben.
Im Forum diskutieren. (8 posts)
Diskutieren (8 Posts)
NTFS compression
Aug 06 2015 11:42:44
Fixierung auf dem Platz braucht! Überprüfen Sie dieses heraus sonst wo auf Kamagra
#2232
Re: NTFS compression
Mar 07 2012 17:31:34
It had something to do with removed articles. It's still not fully fixed. I'll have a look at this within the next few days.
#1248
Re: NTFS compression
Mar 06 2012 13:04:03
And what has happened ? ;/ (trollface.jpg)
#1247
Re: NTFS compression
Mar 06 2012 02:28:00
Ah, yeah. I think we found out what happened. Should be fixed now.
#1246
NTFS compression
Mar 05 2012 23:00:32
I've seen both Eagleeye and Death race. They're both good movies. I think Death race is better because it has cars that look like Mad Max cars and a famous actor Jason in it.
Oh, There's a Death Race sequel by the way. I haven't seen it yet.
#1245
Re: NTFS compression
Mar 05 2012 11:19:11
LOL. Is it possible that you did not quite understand the subject?
#1243
NTFS compression
Mar 04 2012 20:10:55
Seen this movie. It's an awesome movie with the cars that look like the cars from Mad Max. Jason is a good at what he does.
#1241
NTFS compression
Mar 04 2012 20:07:02
Seen it, good movie.
#1240