2016-07-13 4 views
0

Firestreamerで仮想テープライブラリを作成しました。私はその仮想テープにファイルをコピーするコードをC++で書いていました。しかし、私はPrepareTapeウィンドウの機能を持つテープを準備しようとすると失敗します。以下は、PrepareTapeのウィンドウ機能と呼ばれる私のコードの一部です。PrepareTapeがC++コードで失敗する

   /*Tape Handle*/ 
       LPCWSTR tapeName = L"\\\\.\\Tape1"; 
       HANDLE tapeHandle = CreateFile(tapeName, 
        /*GENERIC_READ | GENERIC_WRITE*/ GENERIC_ALL, 
        0, 
        0, 
        OPEN_EXISTING, 
        FILE_ATTRIBUTE_ARCHIVE | FILE_FLAG_BACKUP_SEMANTICS, 
        0); 
       if (tapeHandle == NULL) 
       { 
        cout << "ERROR::Unable To Open handle for the tape in this machine the error is ::" << GetLastError() << endl; 
       } 
       else 
       { 
        wcout << "The Handle for the tape :" << tapeName << " is created successfully" << endl; 
       } 
       /*Prepare Tape*/ 
       DWORD prepareTApeSuccess = PrepareTape(
        tapeHandle, 
        TAPE_LOAD, 
        TRUE 
        ); 

       if (prepareTApeSuccess == NO_ERROR) 
       { 
        cout << "Prepare Tape successsfully executed" << endl; 
       } 
       else 
       { 
        cout << "Prepare Tape Failed with the error :" << prepareTApeSuccess << endl; 
       } 
       if (!CloseHandle(tapeHandle)) 
       { 
        cout << "Close handle for the file is failed with thie error" << GetLastError() << endl; 
       } 

出力

The Handle for the tape :\\.\Tape1 is created successfully 
Prepare Tape Failed with the error :1 

しかし、すべての残りの部分は他のテープの機能は同じハンドルで正常に動作しているすなわち。私はGetTapeStatus関数でテープのステータスを取得しようとしました。テープデバイスは、エラーを返さずに適切なテープアクセスコマンドを受け入れる準備ができています。戻り値はNO_ERRORです。準備テープ機能に予め

答えて

0

おかげで三番目のパラメータを考慮して、このパラメータがTRUEの場合、この関数はすぐに戻ります。 FALSEの場合、操作が完了するまで関数は戻りません。私はそれを偽に変更し、私の問題は解決しました。

関連する問題