Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
RatinCN committed Dec 2, 2024
1 parent 572aea0 commit 57cf54a
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Source/KNSoft.MakeLifeEasier/KNSoft.MakeLifeEasier.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,14 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\packages\KNSoft.Precomp4C.1.0.15-alpha\build\KNSoft.Precomp4C.targets" Condition="Exists('..\packages\KNSoft.Precomp4C.1.0.15-alpha\build\KNSoft.Precomp4C.targets')" />
<Import Project="..\packages\KNSoft.NDK.1.2.11-beta\build\KNSoft.NDK.targets" Condition="Exists('..\packages\KNSoft.NDK.1.2.11-beta\build\KNSoft.NDK.targets')" />
<Import Project="..\packages\KNSoft.NDK.1.2.13-beta\build\KNSoft.NDK.targets" Condition="Exists('..\packages\KNSoft.NDK.1.2.13-beta\build\KNSoft.NDK.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\KNSoft.Precomp4C.1.0.15-alpha\build\KNSoft.Precomp4C.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\KNSoft.Precomp4C.1.0.15-alpha\build\KNSoft.Precomp4C.props'))" />
<Error Condition="!Exists('..\packages\KNSoft.Precomp4C.1.0.15-alpha\build\KNSoft.Precomp4C.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\KNSoft.Precomp4C.1.0.15-alpha\build\KNSoft.Precomp4C.targets'))" />
<Error Condition="!Exists('..\packages\KNSoft.NDK.1.2.11-beta\build\KNSoft.NDK.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\KNSoft.NDK.1.2.11-beta\build\KNSoft.NDK.targets'))" />
<Error Condition="!Exists('..\packages\KNSoft.NDK.1.2.13-beta\build\KNSoft.NDK.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\KNSoft.NDK.1.2.13-beta\build\KNSoft.NDK.targets'))" />
</Target>
</Project>
9 changes: 9 additions & 0 deletions Source/KNSoft.MakeLifeEasier/String/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,15 @@ Str_EqualW(

#pragma endregion

FORCEINLINE
LOGICAL
Str_TestCchRet(
_In_ unsigned long CchRet,
_In_ size_t const BufferCount)
{
return CchRet > 0 && CchRet < BufferCount;
}

#pragma region String PrintF

_Success_(
Expand Down
31 changes: 31 additions & 0 deletions Source/KNSoft.MakeLifeEasier/UI/Message.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,37 @@ UI_EnableDlgItem(
return EnableWindow(GetDlgItem(Dialog, ItemId), EnableState);
}

/// <seealso cref="SendMessageTimeoutW"/>
FORCEINLINE
W32ERROR
UI_SendMessageTimeout(
_In_ HWND Window,
_In_ UINT Msg,
_In_ WPARAM wParam,
_In_ LPARAM lParam,
_In_ UINT fuFlags,
_In_ UINT uTimeout,
_Out_opt_ PDWORD_PTR lpdwResult)
{
LRESULT lr;
W32ERROR Ret;

NtSetLastError(ERROR_SUCCESS);
lr = SendMessageTimeoutW(Window, Msg, wParam, lParam, fuFlags, uTimeout, lpdwResult);
if (lr != 0)
{
Ret = ERROR_SUCCESS;
} else
{
Ret = NtGetLastError();
if (Ret == ERROR_SUCCESS)
{
Ret = ERROR_GEN_FAILURE;
}
}
return Ret;
}

/// <seealso cref="SendMessage"/>
#define UI_SendMsgW(Window, Msg, wParam, lParam) SendMessageW(Window, Msg, (WPARAM)(wParam), (LPARAM)(lParam))
#define UI_SendMsgA(Window, Msg, wParam, lParam) SendMessageA(Window, Msg, (WPARAM)(wParam), (LPARAM)(lParam))
Expand Down
12 changes: 12 additions & 0 deletions Source/KNSoft.MakeLifeEasier/UI/Window.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ UI_TruncateHandle32(
return (ULONG)(ULONG_PTR)Handle32;
}

FORCEINLINE
W32ERROR
UI_GetWindowLong(
_In_ HWND Window,
_In_ INT Index,
_Out_ PLONG_PTR Value)
{
NtSetLastError(ERROR_SUCCESS);
*Value = GetWindowLongPtrW(Window, Index);
return *Value != 0 ? ERROR_SUCCESS : NtGetLastError();
}

/// <seealso cref="PtInRect"/>
FORCEINLINE
LOGICAL
Expand Down
2 changes: 1 addition & 1 deletion Source/KNSoft.MakeLifeEasier/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="KNSoft.NDK" version="1.2.11-beta" targetFramework="native" />
<package id="KNSoft.NDK" version="1.2.13-beta" targetFramework="native" />
<package id="KNSoft.Precomp4C" version="1.0.15-alpha" targetFramework="native" />
</packages>
4 changes: 2 additions & 2 deletions Source/Test/Test.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,12 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\packages\KNSoft.NDK.1.2.11-beta\build\KNSoft.NDK.targets" Condition="Exists('..\packages\KNSoft.NDK.1.2.11-beta\build\KNSoft.NDK.targets')" />
<Import Project="..\packages\KNSoft.NDK.1.2.13-beta\build\KNSoft.NDK.targets" Condition="Exists('..\packages\KNSoft.NDK.1.2.13-beta\build\KNSoft.NDK.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\KNSoft.NDK.1.2.11-beta\build\KNSoft.NDK.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\KNSoft.NDK.1.2.11-beta\build\KNSoft.NDK.targets'))" />
<Error Condition="!Exists('..\packages\KNSoft.NDK.1.2.13-beta\build\KNSoft.NDK.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\KNSoft.NDK.1.2.13-beta\build\KNSoft.NDK.targets'))" />
</Target>
</Project>
2 changes: 1 addition & 1 deletion Source/Test/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="KNSoft.NDK" version="1.2.11-beta" targetFramework="native" />
<package id="KNSoft.NDK" version="1.2.13-beta" targetFramework="native" />
</packages>

0 comments on commit 57cf54a

Please sign in to comment.