This commit is contained in:
Simon Rozman 2017-05-16 13:03:13 +02:00
commit b09610fd5f
23 changed files with 77 additions and 31 deletions

View File

@ -1,5 +1,5 @@
/*
Copyright 1991-2016 Amebis
Copyright 1991-2017 Amebis
Copyright 2016 GÉANT
This file is part of WinStd.

View File

@ -1,5 +1,5 @@
/*
Copyright 1991-2016 Amebis
Copyright 1991-2017 Amebis
Copyright 2016 GÉANT
This file is part of WinStd.
@ -64,6 +64,32 @@ namespace winstd
}
///
/// Queries the object for another interface and creates new class with it
///
/// \sa [IUnknown::QueryInterface method](https://msdn.microsoft.com/en-us/library/windows/desktop/ms682521.aspx)
///
template <class _Other>
inline com_obj(_Out_ _Other **other)
{
assert(other);
other->QueryInterface(__uuidof(T), (void**)&m_h);
}
///
/// Queries the object for another interface and creates new class with it
///
/// \sa [IUnknown::QueryInterface method](https://msdn.microsoft.com/en-us/library/windows/desktop/ms682521.aspx)
///
template <class _Other>
inline com_obj(_Out_ com_obj<_Other> &other)
{
assert(other);
other->QueryInterface(__uuidof(T), (void**)&m_h);
}
///
/// Releases object
///

View File

@ -1,5 +1,5 @@
/*
Copyright 1991-2016 Amebis
Copyright 1991-2017 Amebis
Copyright 2016 GÉANT
This file is part of WinStd.

View File

@ -1,5 +1,5 @@
/*
Copyright 1991-2016 Amebis
Copyright 1991-2017 Amebis
Copyright 2016 GÉANT
This file is part of WinStd.

View File

@ -1,5 +1,5 @@
/*
Copyright 1991-2016 Amebis
Copyright 1991-2017 Amebis
Copyright 2016 GÉANT
This file is part of WinStd.

View File

@ -1,5 +1,5 @@
/*
Copyright 1991-2016 Amebis
Copyright 1991-2017 Amebis
Copyright 2016 GÉANT
This file is part of WinStd.

View File

@ -1,5 +1,5 @@
/*
Copyright 1991-2016 Amebis
Copyright 1991-2017 Amebis
Copyright 2016 GÉANT
This file is part of WinStd.

View File

@ -1,5 +1,5 @@
/*
Copyright 1991-2016 Amebis
Copyright 1991-2017 Amebis
Copyright 2016 GÉANT
This file is part of WinStd.

View File

@ -1,5 +1,5 @@
/*
Copyright 1991-2016 Amebis
Copyright 1991-2017 Amebis
Copyright 2016 GÉANT
This file is part of WinStd.
@ -126,8 +126,6 @@ inline UINT MsiGetPropertyA(_In_ MSIHANDLE hInstall, _In_ LPCSTR szName, _Out_ s
template<class _Elem, class _Traits, class _Ax>
inline UINT MsiGetPropertyW(_In_ MSIHANDLE hInstall, _In_ LPCWSTR szName, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
{
assert(0); // TODO: Test this code.
_Elem szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
DWORD dwSize = _countof(szStackBuffer);
UINT uiResult;
@ -182,8 +180,6 @@ inline UINT MsiRecordGetStringA(_In_ MSIHANDLE hRecord, _In_ unsigned int iField
template<class _Elem, class _Traits, class _Ax>
inline UINT MsiRecordGetStringW(_In_ MSIHANDLE hRecord, _In_ unsigned int iField, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
{
assert(0); // TODO: Test this code.
_Elem szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
DWORD dwSize = _countof(szStackBuffer);
UINT uiResult;
@ -238,8 +234,6 @@ inline UINT MsiFormatRecordA(MSIHANDLE hInstall, MSIHANDLE hRecord, std::basic_s
template<class _Elem, class _Traits, class _Ax>
inline UINT MsiFormatRecordW(MSIHANDLE hInstall, MSIHANDLE hRecord, std::basic_string<_Elem, _Traits, _Ax> &sValue)
{
assert(0); // TODO: Test this code.
_Elem szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
DWORD dwSize = _countof(szStackBuffer);
UINT uiResult;
@ -314,8 +308,6 @@ inline UINT MsiGetTargetPathA(_In_ MSIHANDLE hInstall, _In_ LPCSTR szFolder, _Ou
template<class _Elem, class _Traits, class _Ax>
inline UINT MsiGetTargetPathW(_In_ MSIHANDLE hInstall, _In_ LPCWSTR szFolder, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
{
assert(0); // TODO: Test this code.
_Elem szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
DWORD dwSize = _countof(szStackBuffer);
UINT uiResult;

View File

@ -1,5 +1,5 @@
/*
Copyright 1991-2016 Amebis
Copyright 1991-2017 Amebis
Copyright 2016 GÉANT
This file is part of WinStd.

View File

@ -1,5 +1,5 @@
/*
Copyright 1991-2016 Amebis
Copyright 1991-2017 Amebis
Copyright 2016 GÉANT
This file is part of WinStd.

View File

@ -1,5 +1,5 @@
/*
Copyright 1991-2016 Amebis
Copyright 1991-2017 Amebis
Copyright 2016 GÉANT
This file is part of WinStd.

View File

@ -1,5 +1,5 @@
/*
Copyright 1991-2016 Amebis
Copyright 1991-2017 Amebis
Copyright 2016 GÉANT
This file is part of WinStd.
@ -35,6 +35,7 @@ namespace winstd
class WINSTD_API win_handle;
class WINSTD_API library;
class WINSTD_API process;
class WINSTD_API file;
class WINSTD_API heap;
template <class _Ty> class heap_allocator;
class WINSTD_API actctx_activator;
@ -382,6 +383,33 @@ namespace winstd
};
///
/// File handle wrapper
///
class WINSTD_API file : public win_handle
{
public:
///
/// Opens file handle.
///
/// \sa [CreateFile function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx)
///
/// \return
/// - \c true when succeeds;
/// - \c false when fails. Use `GetLastError()` for failure reason.
///
inline bool create(_In_ LPCTSTR lpFileName, _In_ DWORD dwDesiredAccess, _In_ DWORD dwShareMode, _In_ DWORD dwCreationDisposition, _In_opt_ DWORD dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes = NULL, _In_opt_ HANDLE hTemplateFile = NULL)
{
handle_type h = CreateFile(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
if (h) {
attach(h);
return true;
} else
return false;
}
};
///
/// Heap handle wrapper
///

View File

@ -1,5 +1,5 @@
/*
Copyright 1991-2016 Amebis
Copyright 1991-2017 Amebis
Copyright 2016 GÉANT
This file is part of WinStd.

View File

@ -1,5 +1,5 @@
/*
Copyright 1991-2016 Amebis
Copyright 1991-2017 Amebis
Copyright 2016 GÉANT
This file is part of WinStd.

View File

@ -1,5 +1,5 @@
/*
Copyright 1991-2016 Amebis
Copyright 1991-2017 Amebis
Copyright 2016 GÉANT
This file is part of WinStd.

View File

@ -1,5 +1,5 @@
/*
Copyright 1991-2016 Amebis
Copyright 1991-2017 Amebis
Copyright 2016 GÉANT
This file is part of WinStd.

View File

@ -1,5 +1,5 @@
/*
Copyright 1991-2016 Amebis
Copyright 1991-2017 Amebis
Copyright 2016 GÉANT
This file is part of WinStd.

View File

@ -1,5 +1,5 @@
/*
Copyright 1991-2016 Amebis
Copyright 1991-2017 Amebis
Copyright 2016 GÉANT
This file is part of WinStd.

View File

@ -1,5 +1,5 @@
/*
Copyright 1991-2016 Amebis
Copyright 1991-2017 Amebis
Copyright 2016 GÉANT
This file is part of WinStd.

View File

@ -1,5 +1,5 @@
/*
Copyright 1991-2016 Amebis
Copyright 1991-2017 Amebis
Copyright 2016 GÉANT
This file is part of WinStd.

View File

@ -1,5 +1,5 @@
/*
Copyright 1991-2016 Amebis
Copyright 1991-2017 Amebis
Copyright 2016 GÉANT
This file is part of WinStd.

View File

@ -1,5 +1,5 @@
/*
Copyright 1991-2016 Amebis
Copyright 1991-2017 Amebis
Copyright 2016 GÉANT
This file is part of WinStd.