/** SGX

The   sss    gggg x   x   
     s      g      x x    Engine
      sss   g  gg   x
         s  g   g  x x          Copyright 1995-2009.
     ssss    gggg x   x         Steven Goodwin. All Rights Reserved.
    
This version has been released under the GNU Public License v2.0.

Please see the license files for details.

File: sgx/src/drivers/wintel32/filesystem/win32memcardstate.cpp

*/

#include "sgx/core/core.hpp"
#include "sgx/filesystem/filesystem.hpp"
#include "drivers/wintel32/core/core.hpp"
#include "drivers/wintel32/filesystem/filesystem.hpp"


CSGXDeviceBlockStateWin32MemoryCard::~CSGXDeviceBlockStateWin32MemoryCard() {
	if (m_bSaving) {
        HANDLE  hFile;
		DWORD byteswritten;

        hFile = ::CreateFile(m_pBlock->m_Filename.c_str(), FILE_WRITE_DATA, FILE_SHARE_READ, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
		::WriteFile(hFile, m_pData, m_iSize, &byteswritten, NULL);
		::CloseHandle(hFile);
	}
}

