none
FSCTL_SET_COMPRESSION not supported RRS feed

  • Question

  • Hi all,

    I am working on FSCTL_SET_COMPRESSION  which is supported by WINCE. my code is not working according to the expectations, I am getting error code as "ERROR_NOT_SUPPORTED(0x32)" . Please have a look at my code and tell me where I am wrong. Following is my code. 

    int _tmain(int argc, TCHAR *argv[], TCHAR *envp[])
    {
    HANDLE hFile ; //    = INVALID_HANDLE_VALUE;
        HANDLE hTempFile = INVALID_HANDLE_VALUE; 
    int bResult   = 0;   
    int buff;
    long lBytesRtn;
        DWORD dwBytesWritten = 0;
    char Str[] = "Example text testing WriteFile tyrty yrtuiyreuity yuirty thjgjfg oaouerou dfgdff gfgdfjg";
    USHORT my = COMPRESSION_FORMAT_DEFAULT;
    int myERROR=0;
    int get_atr_error=0;
     )
        TCHAR szTempFileName[MAX_PATH];  
        TCHAR lpTempPathBuffer[MAX_PATH];
        char  chBuffer[BUFSIZE]; 
        LPCTSTR errMsg;

        //  Creates new file/Opens the existing file. 
        hFile = CreateFile(TEXT("\\Release\\two.txt"),               // file name 
                           (GENERIC_WRITE | GENERIC_READ),          // open for reading 
                           0,                     //  share 
                           NULL,                  // default security 
                           OPEN_ALWAYS,         // open or creAte
                           FILE_ATTRIBUTE_NORMAL, // normal file 
                           NULL);                 // no template 
        if (hFile == INVALID_HANDLE_VALUE) 
        { 
           // PrintError(TEXT("First CreateFile failed"));
    printf("File Create failed");
            return (1);
        } 
    printf("File Created successfull");

        myERROR = WriteFile( hFile, Str, strlen(Str), &dwBytesWritten, NULL );

    bResult = DeviceIoControl(hFile,
    FSCTL_SET_COMPRESSION,
    (LPVOID) &my,
    (DWORD) sizeof(my),
    NULL,
    0,
    NULL,// (LPDWORD) lpBytesReturned,
    (LPOVERLAPPED) NULL);

    myERROR=GetLastError();
     
    get_atr_error = GetFileAttributes(TEXT("\\Release\\two.txt"));

    bResult = CloseHandle(hFile); 
      if (bResult == 0){
    printf("file close failed");
    }
    else{
    printf("file close success");
    }
    return 0;
    }

    I am getting myERROR = 0x32 (ERROR_NOT_SUPPORTED). Any help is greatly appreciated.

    Thanks in advance.

    shweta

    Monday, July 21, 2014 11:44 AM

All replies

  • Did you try stepping through the file manager code? All the source is available as part of the shared source program.

    Good luck,

    Michel Verhagen, eMVP
    Check out my blog: http://guruce.com/blog

    GuruCE
    Microsoft Embedded Partner
    http://guruce.com
    Consultancy, training and development services.

    Tuesday, July 22, 2014 2:14 AM
    Moderator
  • Thank you Michel,

    What is  file manager code? I am new to WINCE.Can you tell in detail?


    shweta

    Thursday, July 24, 2014 5:23 AM
  • Do you know what Platform Builder is?

    If not; get in contact with the device manufacturer (or some independent expert) and ask them to tell you why it doesn't work.


    Good luck,

    Michel Verhagen, eMVP
    Check out my blog: http://guruce.com/blog

    GuruCE
    Microsoft Embedded Partner
    http://guruce.com
    Consultancy, training and development services.

    Thursday, July 24, 2014 5:38 AM
    Moderator
  • yeah I have basic knowledge on platform builder. 

    Have you used compression on WINCE?


    shweta

    Thursday, July 24, 2014 5:53 AM
  • No, I have not used compression on WINCE.

    If you know how to use PB, then build a debug kernel with KITL support, download the kernel, set a breakpoint in a strategic place in the file manager code (see \WINCEX00\private\winceos\COREOS\storage\fsdmgr), and run your application.

    Then figure out why the compression is causing problems.

    It may be that it is simply not supported in Windows CE...

    A search for FSCTL_SET_COMPRESSION and "compression" results in 0 occurrences found, so my guess is you're out of luck in Windows CE (but I could be wrong).


    Good luck,

    Michel Verhagen, eMVP
    Check out my blog: http://guruce.com/blog

    GuruCE
    Microsoft Embedded Partner
    http://guruce.com
    Consultancy, training and development services.

    Thursday, July 24, 2014 6:06 AM
    Moderator