Skip to content

Commit

Permalink
Opt #81, 解决一些C++ 20情况下的编译失败
Browse files Browse the repository at this point in the history
  • Loading branch information
sonyps5201314 authored and mingkuang-Chuyu committed May 15, 2024
1 parent 79f518f commit 57f8bb8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/Thunks/api-ms-win-core-file.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,14 +533,16 @@ namespace YY
goto __Exit;
}

const auto _uNewLength = pObjectName->Name.Length - pFileNameInfo->FileNameLength + sizeof(wchar_t);
if (_uNewLength > MAXUINT16)
{
lStatus = ERROR_BAD_PATHNAME;
goto __Exit;
const auto _uNewLength = pObjectName->Name.Length - pFileNameInfo->FileNameLength + sizeof(wchar_t);
if (_uNewLength > MAXUINT16)
{
lStatus = ERROR_BAD_PATHNAME;
goto __Exit;
}
VolumeNtName.Buffer = pObjectName->Name.Buffer;
VolumeNtName.Length = VolumeNtName.MaximumLength = static_cast<USHORT>(_uNewLength);
}
VolumeNtName.Buffer = pObjectName->Name.Buffer;
VolumeNtName.Length = VolumeNtName.MaximumLength = static_cast<USHORT>(_uNewLength);


if (VOLUME_NAME_NT & dwFlags)
Expand Down
2 changes: 1 addition & 1 deletion src/YY-Thunks.UnitTest/bcrypt.UnitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ namespace bcrypt
Assert::IsTrue(_Status >= 0);
Assert::IsNotNull(_hHash);

_Status = ::BCryptHashData(_hHash, reinterpret_cast<PUCHAR>("123"), 3, 0);
_Status = ::BCryptHashData(_hHash, (PUCHAR)"123", 3, 0);
Assert::IsTrue(_Status >= 0);

byte _ShaCurrent[kTargetShaLength] = {};
Expand Down

0 comments on commit 57f8bb8

Please sign in to comment.