mirror of
https://github.com/pocoproject/poco.git
synced 2025-02-20 06:17:15 +01:00
[SF 2835206] File_WIN32 not checking against INVALID_HANDLE_VALUE
This commit is contained in:
parent
49101951a2
commit
1bd3511e89
@ -48,13 +48,16 @@ class FileHandle
|
||||
public:
|
||||
FileHandle(const std::string& path, DWORD access, DWORD share, DWORD disp)
|
||||
{
|
||||
_h = CreateFileA(path.c_str(), access, share, 0, disp, 0, 0);
|
||||
if (!_h) FileImpl::handleLastErrorImpl(path);
|
||||
_h = CreateFileA(upath.c_str(), access, share, 0, disp, 0, 0);
|
||||
if (_h == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
FileImpl::handleLastErrorImpl(path);
|
||||
}
|
||||
}
|
||||
|
||||
~FileHandle()
|
||||
{
|
||||
if (_h) CloseHandle(_h);
|
||||
if (_h != INVALID_HANDLE_VALUE) CloseHandle(_h);
|
||||
}
|
||||
|
||||
HANDLE get() const
|
||||
|
@ -50,12 +50,15 @@ public:
|
||||
FileHandle(const std::string& path, const std::wstring& upath, DWORD access, DWORD share, DWORD disp)
|
||||
{
|
||||
_h = CreateFileW(upath.c_str(), access, share, 0, disp, 0, 0);
|
||||
if (!_h) FileImpl::handleLastErrorImpl(path);
|
||||
if (_h == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
FileImpl::handleLastErrorImpl(path);
|
||||
}
|
||||
}
|
||||
|
||||
~FileHandle()
|
||||
{
|
||||
if (_h) CloseHandle(_h);
|
||||
if (_h != INVALID_HANDLE_VALUE) CloseHandle(_h);
|
||||
}
|
||||
|
||||
HANDLE get() const
|
||||
|
Loading…
x
Reference in New Issue
Block a user