retro-imager/windows/winfile.h

42 lines
901 B
C
Raw Normal View History

2020-03-04 16:55:40 +01:00
#ifndef WINFILE_H
#define WINFILE_H
/*
* SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2020 Raspberry Pi (Trading) Limited
*/
#include <QObject>
#include <QIODevice>
#include <windows.h>
class WinFile : public QObject
{
Q_OBJECT
public:
explicit WinFile(QObject *parent = nullptr);
virtual ~WinFile();
void setFileName(const QString &name);
bool open(QIODevice::OpenMode mode);
void close();
bool isOpen();
qint64 write(const char *data, qint64 maxSize);
qint64 read(char *data, qint64 maxSize);
HANDLE handle();
QString errorString() const;
int errorCode() const;
2020-03-04 16:55:40 +01:00
bool flush();
bool seek(qint64 pos);
qint64 pos();
bool lockVolume();
bool unlockVolume();
protected:
bool _locked;
QString _name, _lasterror;
HANDLE _h;
int _lasterrorcode;
2020-03-04 16:55:40 +01:00
};
#endif // WINFILE_H