itxtech / crystaldiskinfoembedded Goto Github PK
View Code? Open in Web Editor NEWWrap CrystalDiskInfo into a MFC DLL which can be used by other programs.
License: MIT License
Wrap CrystalDiskInfo into a MFC DLL which can be used by other programs.
License: MIT License
DLL library cannot be called in VB or C#,
The DLL library version has been V8.17.14,
How to modify to__ Stdcall, and call demo program
Code run successfully on SATA but not on NVMe. Seem CArray<ATA_SMART_INFO, ATA_SMART_INFO>
vars is always empty in this situation.
I have a question. The InitAtaSmart function must be executed every time disk information is retrieved to refresh the information, but doing so degrades the program's performance, so I wonder if there is a way... The programming language is C# WinForm.
IsWindowsVersionOrGreaterFx (10,0) , on the exe execution file, there is an additional manifest file manifest:
< compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
< application>
< !-- Windows Vista -->
< supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
< !-- Windows 7 -->
< supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
< !-- Windows 8 -->
< supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
< !-- Windows 8.1 -->
< supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
< !-- Windows 10 -->
< supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
< /application>
< /compatibility>
So , can return TRUE on Windows 10 and 11.
If there is no manifest file, the exe execution file has an error on Windows 11.
if you build the CrystalDiskInfo.DLL file, even if the manifest file is attached, the shell program runs on Windows 11 and calls CrystalDiskInfo.DLL. Unfortunately, the program error.
I solved this problem temporarily with a simple method, even without the manifest file of the program.
In OsInfoFx.cpp:
#include "pch.h"
#include "stdafx.h"
#include "OsInfoFx.h"
#include "UtilityFx.h"
typedef BOOL (WINAPI* FuncGetProductInfo)(DWORD, DWORD, DWORD, DWORD, PDWORD);
typedef BOOL (WINAPI* FuncGetNativeSystemInfo)(LPSYSTEM_INFO);
typedef BOOL (WINAPI* FuncIsWow64Process)(HANDLE hProcess,PBOOL Wow64Process);
typedef LONG (WINAPI* FuncRtlGetVersion)(POSVERSIONINFOEXW osvi);
//---add
typedef LONG NTSTATUS, * PNTSTATUS;
#define STATUS_SUCCESS (0x00000000)`
typedef NTSTATUS(WINAPI* RtlGetVersionPtr)(PRTL_OSVERSIONINFOW);
RTL_OSVERSIONINFOW GetRealOSVersion() {
HMODULE hMod = ::GetModuleHandleW(L"ntdll.dll");
if (hMod) {
RtlGetVersionPtr fxPtr = (RtlGetVersionPtr)::GetProcAddress(hMod, "RtlGetVersion");
if (fxPtr != nullptr) {
RTL_OSVERSIONINFOW rovi = { 0 };
rovi.dwOSVersionInfoSize = sizeof(rovi);
if (STATUS_SUCCESS == fxPtr(&rovi)) {
return rovi;
}
}
}
RTL_OSVERSIONINFOW rovi = { 0 };
return rovi;
}
//---
BOOL IsWindowsVersionOrGreaterFx(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor)
{
OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0, {0}, 0, 0 };
DWORDLONG const dwlConditionMask = VerSetConditionMask(
VerSetConditionMask(
VerSetConditionMask(
0, VER_MAJORVERSION, VER_GREATER_EQUAL),
VER_MINORVERSION, VER_GREATER_EQUAL),
VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);
osvi.dwMajorVersion = wMajorVersion;
osvi.dwMinorVersion = wMinorVersion;
osvi.wServicePackMajor = wServicePackMajor;
//---add
//osvi.dwBuildNumber= GetRealOSVersion().dwBuildNumber;
//osvi.dwOSVersionInfoSize = GetRealOSVersion().dwOSVersionInfoSize;
//osvi.dwPlatformId = GetRealOSVersion().dwPlatformId;
DWORD wntMajorVersion= GetRealOSVersion().dwMajorVersion;//W11=10
DWORD wntMinorVersion = GetRealOSVersion().dwMinorVersion;//W11=0
DWORD wntBuildNumber = GetRealOSVersion().dwBuildNumber;//W11=22621
DWORD wntPlatformId = GetRealOSVersion().dwPlatformId;//W11=2
DWORD wntOSVersionInfoSize = GetRealOSVersion().dwOSVersionInfoSize;//W11=276
WCHAR *wntszCSDVersion = GetRealOSVersion().szCSDVersion;//W11=0x012fd0e4
//---modify
if ((wMajorVersion == wntMajorVersion) && (wntBuildNumber > 20000)) //Windows 11
{
return TRUE;
}
else
{
return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE;
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.