Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(MSVC, C++11) Add Network information(interface index, MAC, IPv4, Description) #65

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

MRsoymilk
Copy link
Contributor

The information shows below:
My Network Information

MRsoymilk and others added 6 commits October 23, 2023 17:05
use "Win32_CacheMemory" to get CPU cache size, because "Win32_Processor" can not get L1 cache
Data type of "AdapterRAM " is "uint32", 
using "int" will cause overflow
@lfreist lfreist marked this pull request as ready for review December 5, 2023 12:17
@lfreist lfreist self-requested a review December 5, 2023 12:17
Copy link
Owner

@lfreist lfreist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution. All in all good work! Please address the issues stated in the comments so that I can merge your pull-request.

Also make sure that all files are in line with the coding style (.clang-format)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add dummy implementations for Linux (and OSX) for this classes member functions? They can just return "" but they need to be implemented.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I will try

@@ -36,6 +36,7 @@ class CPU {
~CPU() = default;

int id() const;
const std::string& processorId() const;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this information is useful at all. Maybe just remove it for the time being

@@ -0,0 +1,35 @@
// Copyright MRsoymilk
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot accept copyrighted content for this project

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add Linux (and maybe OSX) dummy implementations for this classes member functions too?

Network() = default;
std::string _interfaceIndex{};
std::string _mac{};
std::string _ipv4{}, _ipv6{};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please write them in separate statements for readability

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once you have added the dummy implementations, you can add the linux and OSX cpp files here too

@@ -0,0 +1,24 @@
// Copyright MRsoymilk
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot accept Copyright code for this project

@@ -91,7 +91,7 @@ std::vector<double> CPU::threadsUtilisation() const {
std::vector<CPU> getAllCPUs() {
utils::WMI::_WMI wmi;
const std::wstring query_string(
L"SELECT Name, Manufacturer, NumberOfCores, NumberOfLogicalProcessors, MaxClockSpeed, L2CacheSize, L3CacheSize "
L"SELECT Name, Manufacturer, NumberOfCores, NumberOfLogicalProcessors, MaxClockSpeed, ProcessorId "
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove ProcessorId

@@ -0,0 +1,80 @@
// Copyright (c) MRsoymilk <codermrsoymilk@gmail.com>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i cannot accept copyright code for this project

@@ -11,9 +11,10 @@ namespace utils {
namespace WMI {

_WMI::_WMI() {
auto res = CoInitializeSecurity(nullptr, -1, nullptr, nullptr, RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE,
HRESULT res{-1};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better initialize res with the return value of the first statement

@MRsoymilk
Copy link
Contributor Author

it seems a lot of things that need to be modified and it will take me some time to do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants