Merge branch 'master' of https://github.com/Amebis/WinStd
This commit is contained in:
commit
b09610fd5f
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 1991-2016 Amebis
|
Copyright 1991-2017 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of WinStd.
|
This file is part of WinStd.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 1991-2016 Amebis
|
Copyright 1991-2017 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of WinStd.
|
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
|
/// Releases object
|
||||||
///
|
///
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 1991-2016 Amebis
|
Copyright 1991-2017 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of WinStd.
|
This file is part of WinStd.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 1991-2016 Amebis
|
Copyright 1991-2017 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of WinStd.
|
This file is part of WinStd.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 1991-2016 Amebis
|
Copyright 1991-2017 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of WinStd.
|
This file is part of WinStd.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 1991-2016 Amebis
|
Copyright 1991-2017 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of WinStd.
|
This file is part of WinStd.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 1991-2016 Amebis
|
Copyright 1991-2017 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of WinStd.
|
This file is part of WinStd.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 1991-2016 Amebis
|
Copyright 1991-2017 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of WinStd.
|
This file is part of WinStd.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 1991-2016 Amebis
|
Copyright 1991-2017 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of WinStd.
|
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>
|
template<class _Elem, class _Traits, class _Ax>
|
||||||
inline UINT MsiGetPropertyW(_In_ MSIHANDLE hInstall, _In_ LPCWSTR szName, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
|
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)];
|
_Elem szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
|
||||||
DWORD dwSize = _countof(szStackBuffer);
|
DWORD dwSize = _countof(szStackBuffer);
|
||||||
UINT uiResult;
|
UINT uiResult;
|
||||||
@ -182,8 +180,6 @@ inline UINT MsiRecordGetStringA(_In_ MSIHANDLE hRecord, _In_ unsigned int iField
|
|||||||
template<class _Elem, class _Traits, class _Ax>
|
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)
|
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)];
|
_Elem szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
|
||||||
DWORD dwSize = _countof(szStackBuffer);
|
DWORD dwSize = _countof(szStackBuffer);
|
||||||
UINT uiResult;
|
UINT uiResult;
|
||||||
@ -238,8 +234,6 @@ inline UINT MsiFormatRecordA(MSIHANDLE hInstall, MSIHANDLE hRecord, std::basic_s
|
|||||||
template<class _Elem, class _Traits, class _Ax>
|
template<class _Elem, class _Traits, class _Ax>
|
||||||
inline UINT MsiFormatRecordW(MSIHANDLE hInstall, MSIHANDLE hRecord, std::basic_string<_Elem, _Traits, _Ax> &sValue)
|
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)];
|
_Elem szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
|
||||||
DWORD dwSize = _countof(szStackBuffer);
|
DWORD dwSize = _countof(szStackBuffer);
|
||||||
UINT uiResult;
|
UINT uiResult;
|
||||||
@ -314,8 +308,6 @@ inline UINT MsiGetTargetPathA(_In_ MSIHANDLE hInstall, _In_ LPCSTR szFolder, _Ou
|
|||||||
template<class _Elem, class _Traits, class _Ax>
|
template<class _Elem, class _Traits, class _Ax>
|
||||||
inline UINT MsiGetTargetPathW(_In_ MSIHANDLE hInstall, _In_ LPCWSTR szFolder, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
|
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)];
|
_Elem szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
|
||||||
DWORD dwSize = _countof(szStackBuffer);
|
DWORD dwSize = _countof(szStackBuffer);
|
||||||
UINT uiResult;
|
UINT uiResult;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 1991-2016 Amebis
|
Copyright 1991-2017 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of WinStd.
|
This file is part of WinStd.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 1991-2016 Amebis
|
Copyright 1991-2017 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of WinStd.
|
This file is part of WinStd.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 1991-2016 Amebis
|
Copyright 1991-2017 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of WinStd.
|
This file is part of WinStd.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 1991-2016 Amebis
|
Copyright 1991-2017 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of WinStd.
|
This file is part of WinStd.
|
||||||
@ -35,6 +35,7 @@ namespace winstd
|
|||||||
class WINSTD_API win_handle;
|
class WINSTD_API win_handle;
|
||||||
class WINSTD_API library;
|
class WINSTD_API library;
|
||||||
class WINSTD_API process;
|
class WINSTD_API process;
|
||||||
|
class WINSTD_API file;
|
||||||
class WINSTD_API heap;
|
class WINSTD_API heap;
|
||||||
template <class _Ty> class heap_allocator;
|
template <class _Ty> class heap_allocator;
|
||||||
class WINSTD_API actctx_activator;
|
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
|
/// Heap handle wrapper
|
||||||
///
|
///
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 1991-2016 Amebis
|
Copyright 1991-2017 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of WinStd.
|
This file is part of WinStd.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 1991-2016 Amebis
|
Copyright 1991-2017 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of WinStd.
|
This file is part of WinStd.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 1991-2016 Amebis
|
Copyright 1991-2017 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of WinStd.
|
This file is part of WinStd.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 1991-2016 Amebis
|
Copyright 1991-2017 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of WinStd.
|
This file is part of WinStd.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 1991-2016 Amebis
|
Copyright 1991-2017 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of WinStd.
|
This file is part of WinStd.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 1991-2016 Amebis
|
Copyright 1991-2017 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of WinStd.
|
This file is part of WinStd.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 1991-2016 Amebis
|
Copyright 1991-2017 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of WinStd.
|
This file is part of WinStd.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 1991-2016 Amebis
|
Copyright 1991-2017 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of WinStd.
|
This file is part of WinStd.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 1991-2016 Amebis
|
Copyright 1991-2017 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of WinStd.
|
This file is part of WinStd.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 1991-2016 Amebis
|
Copyright 1991-2017 Amebis
|
||||||
Copyright 2016 GÉANT
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
This file is part of WinStd.
|
This file is part of WinStd.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user