Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
1. fix read camrea panel maybe crash
  • Loading branch information
oven425 committed Nov 6, 2024
1 parent bb3d5d6 commit 008032f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ public static partial class DevMgrExtension
static DEVPROPKEY DEVPKEY_Devices_PhysicalDeviceLocation = new DEVPROPKEY() { fmtid = Guid.Parse("{540B947E-8B40-45BC-A8A2-6A0B894CBDA2}"), pid = 9 };
public static CameraPanel Panel(this (IntPtr dev, SP_DEVINFO_DATA devdata) src)
{
uint propertytype = 0;

int reqsz = 0;
SetupDiGetDeviceProperty(src.dev, ref src.devdata, ref DEVPKEY_Devices_PhysicalDeviceLocation, out propertytype, IntPtr.Zero, 0, out reqsz, 0);

var bb = SetupDiGetDeviceProperty(src.dev, ref src.devdata, ref DEVPKEY_Devices_PhysicalDeviceLocation, out var propertytype, IntPtr.Zero, 0, out reqsz, 0);
if (!bb && reqsz == 0) return CameraPanel.Unknow;

using var mem = new IntPtrMem<byte>(reqsz);
SetupDiGetDeviceProperty(src.dev, ref src.devdata, ref DEVPKEY_Devices_PhysicalDeviceLocation, out propertytype, mem.Pointer, reqsz, out reqsz, 0);
Expand Down
12 changes: 3 additions & 9 deletions QSoft.DevCon/QSoft.DevCon.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<PropertyGroup>
<Title>DevCon.NET</Title>
<VersionPrefix>2.0.0.2</VersionPrefix>
<VersionPrefix>2.0.0.3</VersionPrefix>
<TargetFrameworks>net8.0-windows;net6.0-windows;net472;net481;net462;net460</TargetFrameworks>
<LangVersion>11.0</LangVersion>
<LangVersion>12.0</LangVersion>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageIcon>48607350112_057637c3b5_o.jpg</PackageIcon>
Expand All @@ -16,13 +16,7 @@
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<Copyright>Copyright © Ben Hsu 2022</Copyright>
<Description>easy get device manager info</Description>
<PackageReleaseNotes>1. Add get DriverInfSection
2. Add get FirstInstallDate
3. Add get DriverProvider
4. Add get ProblemCodec
5. Add get Siblings
6. Add get IsConnected for test
7. change assembly naming rule, hope multi versions in same solution</PackageReleaseNotes>
<PackageReleaseNotes>1. fix crash when camera panel can't read</PackageReleaseNotes>
<PlatformTarget>AnyCPU</PlatformTarget>
<PackageId>$(MSBuildProjectName)</PackageId>
<Authors>$(MSBuildProjectName)</Authors>
Expand Down

0 comments on commit 008032f

Please sign in to comment.