Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/inc/internal/AppxBlockMapObject.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ namespace MSIX {
return static_cast<HRESULT>(Error::OK);
} CATCH_RETURN();

HRESULT STDMETHODCALLTYPE ValidateFileHash(IStream *fileStream, BOOL *isValid) noexcept override
HRESULT STDMETHODCALLTYPE ValidateFileHash(IStream */*fileStream*/, BOOL */*isValid*/) noexcept override
{
return static_cast<HRESULT>(Error::NotImplemented);
}
Expand Down
4 changes: 2 additions & 2 deletions src/inc/internal/AppxBundleManifest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace MSIX {
// IVerifierObject
bool HasStream() override { return !!m_stream; }
ComPtr<IStream> GetStream() override { return m_stream; }
ComPtr<IStream> GetValidationStream(const std::string& part, const ComPtr<IStream>&) override { NOTSUPPORTED; }
ComPtr<IStream> GetValidationStream(const std::string& /*part*/, const ComPtr<IStream>&) override { NOTSUPPORTED; }
const std::string& GetPublisher() override { NOTSUPPORTED; }

// IAppxBundleManifestReader
Expand Down Expand Up @@ -91,7 +91,7 @@ namespace MSIX {
return S_OK;
}

HRESULT STDMETHODCALLTYPE GetDXFeatureLevel(DX_FEATURE_LEVEL *dxFeatureLevel) noexcept override
HRESULT STDMETHODCALLTYPE GetDXFeatureLevel(DX_FEATURE_LEVEL */*dxFeatureLevel*/) noexcept override
{
return static_cast<HRESULT>(Error::NotImplemented);
}
Expand Down
4 changes: 2 additions & 2 deletions src/inc/internal/AppxFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace MSIX {
return static_cast<HRESULT>(Error::OK);
}

virtual HRESULT STDMETHODCALLTYPE GetContentType(LPWSTR* contentType) noexcept override
virtual HRESULT STDMETHODCALLTYPE GetContentType(LPWSTR* /*contentType*/) noexcept override
{
return static_cast<HRESULT>(Error::NotImplemented);
}
Expand Down Expand Up @@ -72,7 +72,7 @@ namespace MSIX {
} CATCH_RETURN();

// IAppxFileUtf8
virtual HRESULT STDMETHODCALLTYPE GetContentType(LPSTR* contentType) noexcept override
virtual HRESULT STDMETHODCALLTYPE GetContentType(LPSTR* /*contentType*/) noexcept override
{
return static_cast<HRESULT>(Error::NotImplemented);
}
Expand Down
12 changes: 6 additions & 6 deletions src/inc/internal/AppxManifestObject.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ namespace MSIX {
{}

// IAppxManifestApplication
HRESULT STDMETHODCALLTYPE GetStringValue(LPCWSTR name, LPWSTR* value) noexcept override
HRESULT STDMETHODCALLTYPE GetStringValue(LPCWSTR /*name*/, LPWSTR* /*value*/) noexcept override
{
return static_cast<HRESULT>(Error::NotImplemented);
}
Expand All @@ -146,7 +146,7 @@ namespace MSIX {
} CATCH_RETURN();

// IAppxManifestApplicationUtf8
HRESULT STDMETHODCALLTYPE GetStringValue(LPCSTR name, LPSTR* value) noexcept override
HRESULT STDMETHODCALLTYPE GetStringValue(LPCSTR /*name*/, LPSTR* /*value*/) noexcept override
{
return static_cast<HRESULT>(Error::NotImplemented);
}
Expand Down Expand Up @@ -368,7 +368,7 @@ namespace MSIX {
class AppxManifestQualifiedResource final : public ComClass<AppxManifestQualifiedResource, IAppxManifestQualifiedResource, IAppxManifestQualifiedResourceUtf8, IAppxManifestQualifiedResourceInternal>
{
public:
AppxManifestQualifiedResource(IMsixFactory* factory, std::string& language, std::string& scale, std::string& DXFeatureLevel) :
AppxManifestQualifiedResource(IMsixFactory* factory, std::string& language, std::string& /*scale*/, std::string& /*DXFeatureLevel*/) :
m_factory(factory), m_language(language)
{
//TODO: Process and assign scale and DXFeatureLevel
Expand All @@ -381,12 +381,12 @@ namespace MSIX {
return m_factory->MarshalOutString(m_language, language);
} CATCH_RETURN();

HRESULT STDMETHODCALLTYPE GetScale(UINT32 *scale) noexcept override try
HRESULT STDMETHODCALLTYPE GetScale(UINT32 */*scale*/) noexcept override try
{
return static_cast<HRESULT>(Error::NotImplemented);
} CATCH_RETURN();

HRESULT STDMETHODCALLTYPE GetDXFeatureLevel(DX_FEATURE_LEVEL *dxFeatureLevel) noexcept override try
HRESULT STDMETHODCALLTYPE GetDXFeatureLevel(DX_FEATURE_LEVEL */*dxFeatureLevel*/) noexcept override try
{
return static_cast<HRESULT>(Error::NotImplemented);
} CATCH_RETURN();
Expand Down Expand Up @@ -446,7 +446,7 @@ namespace MSIX {
// IVerifierObject
bool HasStream() override { return !!m_stream; }
ComPtr<IStream> GetStream() override { return m_stream; }
ComPtr<IStream> GetValidationStream(const std::string& part, const ComPtr<IStream>&) override { NOTSUPPORTED; }
ComPtr<IStream> GetValidationStream(const std::string& /*part*/, const ComPtr<IStream>&) override { NOTSUPPORTED; }
const std::string& GetPublisher() override { NOTSUPPORTED; }

// IAppxManifestObject
Expand Down
9 changes: 6 additions & 3 deletions src/inc/internal/BlockMapStream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
// See LICENSE file in the project root for full license information.
//
#pragma once
#ifndef NOMINMAX
#define NOMINMAX /* windows.h, or more correctly windef.h, defines min as a macro... */
#endif

#include "MSIXWindows.hpp"
#include "Exceptions.hpp"
#include "StreamBase.hpp"
Expand Down Expand Up @@ -59,7 +62,7 @@ namespace MSIX {
// Build a vector of all HashStream->RangeStream's for the blocks in the blockmap
std::uint64_t offset = 0;
std::uint64_t sizeRemaining = m_streamSize;
for (auto block = blocks.begin(); ((sizeRemaining != 0) && (block != blocks.end())); block++)
for (auto block = blocks.begin(); ((sizeRemaining != 0) && (block != blocks.end())); ++block)
{
auto rangeStream = ComPtr<IStream>::Make<RangeStream>(offset, std::min(sizeRemaining, BLOCKMAP_BLOCK_SIZE), stream.Get());
auto hashStream = ComPtr<IStream>::Make<HashStream>(rangeStream, block->hash);
Expand Down Expand Up @@ -104,7 +107,7 @@ namespace MSIX {
return S_OK;
} CATCH_RETURN();

HRESULT STDMETHODCALLTYPE Read(void* buffer, ULONG countBytes, ULONG* actualRead) noexcept override try
HRESULT STDMETHODCALLTYPE Read(_Out_cap_(countBytes) void* buffer, ULONG countBytes, ULONG* actualRead) noexcept override try
{
std::uint32_t bytesRead = 0;
if (m_relativePosition < m_streamSize)
Expand All @@ -114,7 +117,7 @@ namespace MSIX {
{
if ((m_currentBlock->offset + m_currentBlock->size) <= m_relativePosition)
{
m_currentBlock++;
++m_currentBlock;
}
else if (m_currentBlock->offset <= m_relativePosition)
{
Expand Down
3 changes: 1 addition & 2 deletions src/inc/internal/Encoding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
#pragma once

#include <string>
#include <cstdint>

namespace MSIX { namespace Encoding {

std::string DecodeFileName(const std::string& fileName);
std::string EncodeFileName(const std::string& fileName);

std::string Base32Encoding(const std::vector<uint8_t>& bytes);
std::vector<std::uint8_t> GetBase64DecodedValue(const std::string& value);
std::vector<uint8_t> GetBase64DecodedValue(const std::string& value);

} /*Encoding */ } /* MSIX */
2 changes: 1 addition & 1 deletion src/inc/internal/FileStream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ namespace MSIX {
return static_cast<HRESULT>(Error::OK);
} CATCH_RETURN();

HRESULT STDMETHODCALLTYPE Read(void* buffer, ULONG countBytes, ULONG* bytesRead) noexcept override try
HRESULT STDMETHODCALLTYPE Read(_Out_cap_(countBytes) void* buffer, ULONG countBytes, ULONG* bytesRead) noexcept override try
{
if (bytesRead) { *bytesRead = 0; }
ULONG result = static_cast<ULONG>(std::fread(buffer, sizeof(std::uint8_t), countBytes, m_file));
Expand Down
7 changes: 5 additions & 2 deletions src/inc/internal/HashStream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
// See LICENSE file in the project root for full license information.
//
#pragma once
#ifndef NOMINMAX
#define NOMINMAX /* windows.h, or more correctly windef.h, defines min as a macro... */
#endif

#include "MSIXWindows.hpp"
#include "Exceptions.hpp"
#include "StreamBase.hpp"
Expand Down Expand Up @@ -98,7 +101,7 @@ namespace MSIX {
return static_cast<HRESULT>(Error::OK);
} CATCH_RETURN();

void CacheRead(void* buffer, ULONG countBytes, ULONG* actualRead)
void CacheRead(_Out_cap_(countBytes) void* buffer, ULONG countBytes, ULONG* actualRead)
{
ThrowErrorIf(Error::Stg_E_Invalidpointer, (buffer == nullptr), "bad input");
ULONG bytesToRead = std::min((std::uint32_t)countBytes, static_cast<std::uint32_t>((std::uint64_t)m_cacheBuffer->size() - m_relativePosition));
Expand All @@ -112,7 +115,7 @@ namespace MSIX {
if (actualRead) { *actualRead = bytesToRead; }
}

HRESULT STDMETHODCALLTYPE Read(void* buffer, ULONG countBytes, ULONG* actualRead) noexcept override try
HRESULT STDMETHODCALLTYPE Read(_Out_cap_(countBytes) void* buffer, ULONG countBytes, ULONG* actualRead) noexcept override try
{
Validate();
if (m_cacheBuffer.get() == nullptr)
Expand Down
2 changes: 1 addition & 1 deletion src/inc/internal/InflateStream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace MSIX {

HRESULT STDMETHODCALLTYPE Seek(LARGE_INTEGER move, DWORD origin, ULARGE_INTEGER *newPosition) noexcept override;
HRESULT STDMETHODCALLTYPE Read(void* buffer, ULONG countBytes, ULONG* bytesRead) noexcept override;
HRESULT STDMETHODCALLTYPE Write(void const *buffer, ULONG countBytes, ULONG *bytesWritten) noexcept override
HRESULT STDMETHODCALLTYPE Write(void const */*buffer*/, ULONG /*countBytes*/, ULONG */*bytesWritten*/) noexcept override
{
return static_cast<HRESULT>(Error::NotImplemented);
}
Expand Down
4 changes: 2 additions & 2 deletions src/inc/internal/MappingFileParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

namespace MSIX {

typedef enum : UINT32
enum HandlerState : UINT32
{
Continue = 0,
Stop,
SkipSection,
Fail
} HandlerState;
};

enum SectionID
{
Expand Down
6 changes: 3 additions & 3 deletions src/inc/internal/ObjectBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class TypeList
std::tuple<Types...> fields;

template<std::size_t index = 0, typename FuncT, class... Args>
inline typename std::enable_if<index == last_index, void>::type for_each(FuncT, Args&&... args) { }
inline typename std::enable_if<index == last_index, void>::type for_each(FuncT, Args&&... /*args*/) { }

template<std::size_t index = 0, typename FuncT, class... Args>
inline typename std::enable_if<index < last_index, void>::type for_each(FuncT f, Args&&... args)
Expand All @@ -202,7 +202,7 @@ class StructuredObject : public TypeList<Types...>
size_t Size()
{
size_t result = 0;
this->for_each([](auto& field, std::size_t index, size_t& result)
this->for_each([](auto& field, std::size_t /*index*/, size_t& result)
{
result += field.Size();
}, result);
Expand All @@ -213,7 +213,7 @@ class StructuredObject : public TypeList<Types...>
{
THROW_IF_PACK_NOT_ENABLED
std::vector<std::uint8_t> bytes;
this->for_each([](auto& field, std::size_t index, std::vector<std::uint8_t>& bytes)
this->for_each([](auto& field, std::size_t /*index*/, std::vector<std::uint8_t>& bytes)
{
field.GetBytes(bytes);
}, bytes);
Expand Down
2 changes: 1 addition & 1 deletion src/inc/internal/RangeStream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ namespace MSIX {
return static_cast<HRESULT>(Error::OK);
} CATCH_RETURN();

HRESULT STDMETHODCALLTYPE Read(void* buffer, ULONG countBytes, ULONG* bytesRead) noexcept override try
HRESULT STDMETHODCALLTYPE Read(_Out_cap_(countBytes) void* buffer, ULONG countBytes, ULONG* bytesRead) noexcept override try
{
LARGE_INTEGER offset = {0};
offset.QuadPart = m_relativePosition + m_offset;
Expand Down
2 changes: 1 addition & 1 deletion src/inc/internal/VectorStream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace MSIX {
public:
VectorStream(std::vector<std::uint8_t>* data) : m_data(data) {}

HRESULT STDMETHODCALLTYPE Read(void* buffer, ULONG countBytes, ULONG* bytesRead) noexcept override try
HRESULT STDMETHODCALLTYPE Read(_Out_cap_(countBytes) void* buffer, ULONG countBytes, ULONG* bytesRead) noexcept override try
{
ULONG amountToRead = std::min(countBytes, static_cast<ULONG>(m_data->size() - m_offset));
if (amountToRead > 0) { memcpy(buffer, &(m_data->at(m_offset)), amountToRead); }
Expand Down
1 change: 0 additions & 1 deletion src/inc/internal/ZipObject.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,6 @@ namespace MSIX {
{
public:
ZipObject(const ComPtr<IStream>& stream) : m_stream(stream) {}
ZipObject(const ComPtr<IStorageObject>& storageObject);

protected:
EndCentralDirectoryRecord m_endCentralDirectoryRecord;
Expand Down
2 changes: 0 additions & 2 deletions src/inc/internal/ZipObjectWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ namespace MSIX {
public:
ZipObjectWriter(const ComPtr<IStream>& stream);

ZipObjectWriter(const ComPtr<IStorageObject>& storageObject);

// IStorage methods
std::vector<std::string> GetFileNames(FileNameOptions options) override;
ComPtr<IStream> GetFile(const std::string& fileName) override;
Expand Down
2 changes: 2 additions & 0 deletions src/inc/public/MSIXWindows.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
#endif

#define UNICODE
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h>
// Windows.h defines max and min, which does NOT play nice at all with std::min / std::max usage from <algorithm>
#undef max
Expand Down
5 changes: 5 additions & 0 deletions src/inc/public/MsixErrors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
#ifndef MSIX_MSIX_ERRORS__H
#define MSIX_MSIX_ERRORS__H

#ifdef WIN32
#include <cstdint>
#endif


namespace MSIX {

static const std::uint32_t ERROR_FACILITY = 0x8BAD0000; // Facility 2989
Expand Down
2 changes: 1 addition & 1 deletion src/inc/shared/StreamBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ namespace MSIX {
virtual std::string GetName() override { NOTIMPLEMENTED; }

template <class T>
static ULONG Read(const ComPtr<IStream>& stream, T* value)
static ULONG Read(const ComPtr<IStream>& stream, _Out_cap_(sizeof(T)) T* value)
{
ULONG result = 0;
ThrowHrIfFailed(stream->Read(value, static_cast<ULONG>(sizeof(T)), &result));
Expand Down
1 change: 1 addition & 0 deletions src/makemsix/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ Command CreateBundleCommand()
#pragma endregion

// Defines the grammar of commands and each command's associated options,
#pragma warning(suppress: 4007) // Suppress 'main': must be '__cdecl'
int main(int argc, char* argv[])
{
std::cout << "Microsoft (R) makemsix version " << SDK_VERSION << std::endl;
Expand Down
4 changes: 2 additions & 2 deletions src/msix/PAL/Applicability/Win32/Applicability.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
//
#include <windows.h>
#include <VersionHelpers.h>
#include <wrl\wrappers\corewrappers.h>
#include <wrl\client.h>
#include <wrl/wrappers/corewrappers.h>
#include <wrl/client.h>
#include <windows.system.userprofile.h>

#include "Applicability.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/msix/PAL/Crypto/Win32/Crypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include <memory>
#include <vector>
#include <wincrypt.h>

struct unique_hash_handle_deleter {
void operator()(BCRYPT_HASH_HANDLE h) const {
Expand Down
4 changes: 2 additions & 2 deletions src/msix/PAL/FileSystem/Win32/DirectoryObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace MSIX
}

template <class Lambda>
void WalkDirectory(const std::string& root, WalkOptions options, Lambda& visitor)
void WalkDirectory(const std::string& root, WalkOptions options, Lambda visitor)
{
static std::string dot(".");
static std::string dotdot("..");
Expand Down Expand Up @@ -323,7 +323,7 @@ namespace MSIX
auto rootSize = m_root.size() + 1; // plus separator
WalkDirectory(m_root, WalkOptions::Recursive | WalkOptions::Files, [&](
std::string root,
WalkOptions option,
WalkOptions /*option*/,
std::string&& name,
std::uint64_t lastWrite)
{
Expand Down
4 changes: 2 additions & 2 deletions src/msix/PAL/Signature/Win32/SignatureValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ namespace MSIX
&cbDecoded))
{
unique_local_alloc_handle basicConstraints(basicConstraintsT);
return basicConstraintsT->fCA ? true : false;
return basicConstraintsT->fCA;
}
return false;
}
Expand Down Expand Up @@ -494,7 +494,7 @@ namespace MSIX


bool SignatureValidator::Validate(
IMsixFactory* factory,
IMsixFactory* /*factory*/,
MSIX_VALIDATION_OPTION option,
const ComPtr<IStream>& stream,
AppxSignatureObject* signatureObject,
Expand Down
Loading