Skip to content

Commit

Permalink
v10.9.2024.0902
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Sep 2, 2024
1 parent 41898c2 commit 980be3c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 32 deletions.
2 changes: 1 addition & 1 deletion NewLife.Agent/NewLife.Agent.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
</None>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'!='net40'">
<PackageReference Include="NewLife.Core" Version="10.10.2024.0803" />
<PackageReference Include="NewLife.Core" Version="10.10.2024.0902" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net40'">
<PackageReference Include="NewLife.Core" Version="10.10.2024.0801-net40" />
Expand Down
12 changes: 6 additions & 6 deletions NewLife.Agent/Windows/Desktop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public UInt32 StartProcess(String fileName, String commandLine = null, String wo
var saProcessAttributes = new SecurityAttributes();
var saThreadAttributes = new SecurityAttributes();
var createProcessFlags = (noWindow ? CreateProcessFlags.CREATE_NO_WINDOW : CreateProcessFlags.CREATE_NEW_CONSOLE) | CreateProcessFlags.CREATE_UNICODE_ENVIRONMENT;
var success = CreateProcessAsUser(duplicateToken, null, file + ' ' + commandLine, ref saProcessAttributes, ref saThreadAttributes, false, createProcessFlags, environmentBlock, null, ref psi, out ProcessInformation pi);
var success = CreateProcessAsUser(duplicateToken, null, file + ' ' + commandLine, ref saProcessAttributes, ref saThreadAttributes, false, createProcessFlags, environmentBlock, null, ref psi, out var pi);
if (!success)
{
throw new Win32Exception(Marshal.GetLastWin32Error());
Expand Down Expand Up @@ -154,8 +154,8 @@ public UInt32 StartProcess(String fileName, String commandLine = null, String wo
private Boolean InPathOfSpecificUserEnvironment(in IntPtr userToken, in IntPtr environmentBlock, in String command)
{
// 在指定用户会话环境中执行命令,并且获得控制台标准输出内容
String commandLine = $"cmd.exe /c chcp 65001 && where {command}";
String output = ExecuteCommandAsUserAndReturnStdOutput(userToken, environmentBlock, commandLine, Encoding.UTF8);
var commandLine = $"cmd.exe /c chcp 65001 && where {command}";
var output = ExecuteCommandAsUserAndReturnStdOutput(userToken, environmentBlock, commandLine, Encoding.UTF8);

// OperatingSystem.IsOSPlatform("WINDOWS") 该方法仅在 .NET Core及以上版本可用,在 .NET Standard 和 .NET Framework 中不可用。
// 现有操作系统中,Windows 操作系统的目录分隔符为 '\',而 Unix 操作系统的目录分隔符为 '/',因此可以用它来判断和区分操作系统。
Expand All @@ -174,7 +174,7 @@ private String ExecuteCommandAsUserAndReturnStdOutput(in IntPtr userToken, in In
saPipeAttributes.Length = Marshal.SizeOf(saPipeAttributes);
saPipeAttributes.InheritHandle = true; // 允许句柄被继承
//saPipeAttributes.SecurityDescriptor = IntPtr.Zero;
if (!CreatePipe(out IntPtr readPipe, out IntPtr writePipe, ref saPipeAttributes, 0))
if (!CreatePipe(out var readPipe, out var writePipe, ref saPipeAttributes, 0))
{
throw new Win32Exception(Marshal.GetLastWin32Error());
}
Expand Down Expand Up @@ -214,7 +214,7 @@ private String ExecuteCommandAsUserAndReturnStdOutput(in IntPtr userToken, in In
environmentBlock,
null,
ref startInfo,
out ProcessInformation pi);
out var pi);
if (!success)
{
throw new Win32Exception(Marshal.GetLastWin32Error());
Expand Down Expand Up @@ -377,7 +377,7 @@ private static extern Boolean CreateProcessAsUser(
private static extern Boolean SetTokenInformation(IntPtr TokenHandle, TokenInformationClass TokenInformationClass, ref UInt32 TokenInformation, UInt32 TokenInformationLength);

[DllImport("kernel32.dll", SetLastError = true)]
public static extern Boolean SetHandleInformation(IntPtr hObject, UInt32 dwMask, UInt32 dwFlags);
private static extern Boolean SetHandleInformation(IntPtr hObject, UInt32 dwMask, UInt32 dwFlags);

private const UInt32 TOKEN_DUPLICATE = 0x0002;
private const UInt32 MAXIMUM_ALLOWED = 0x2000000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Description>应用程序注册为系统服务,支持Windows/Linux</Description>
<Company>新生命开发团队</Company>
<Copyright>©2002-2024 NewLife</Copyright>
<VersionPrefix>10.7</VersionPrefix>
<VersionPrefix>10.9</VersionPrefix>
<VersionSuffix>$([System.DateTime]::Now.ToString(`yyyy.MMdd`))</VersionSuffix>
<Version>$(VersionPrefix).$(VersionSuffix)</Version>
<FileVersion>$(Version)</FileVersion>
Expand Down Expand Up @@ -48,24 +48,24 @@
</PackageReference>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp3.1'">
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="3.1.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net5.0'">
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="5.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net6.0'">
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net7.0'">
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net8.0'">
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<Content Include="..\Doc\leaf.png" Link="leaf.png" PackagePath="\" />
Expand Down
15 changes: 0 additions & 15 deletions Zero.Web/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:2022",
"sslPort": 44327
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Zero.Web": {
"commandName": "Project",
"launchBrowser": true,
Expand Down

0 comments on commit 980be3c

Please sign in to comment.