Solved

Any API call to find OS? Any API to find Subnet Mask?

Posted on 1998-09-24
7
361 Views
Last Modified: 2013-11-20
MFC App. Need to find OS, such as NT, 95, or 98. Any API? Also need to find subnet mask.
0
Comment
Question by:ames
  • 3
  • 3
7 Comments
 
LVL 2

Expert Comment

by:kinkajou
Comment Utility
To get the version information use GetVersionEx().
0
 
LVL 86

Accepted Solution

by:
jkr earned 200 total points
Comment Utility
OSVERSIONINFO osviVerInfo;
osviVerInfo.dwOSVersionInfoSize = sizeof ( OSVERSIONINFO);
                  
GetVersionEx ( &osviVerInfo);

switch ( osviVerInfo.dwPlatformId)
{
 case VER_PLATFORM_WIN32_WINDOWS: // Win32 on Win95
      break;
 case VER_PLATFORM_WIN32_NT: // Win32 on WinNT
      break;
 case VER_PLATFORM_WIN32_WIN32sS: // Win32s on Win 3.x
      break;
}

as there's no 'official' API to obtain the netmask, i suggest running 'netstat -r' and analyzing its output
 
                  

0
 
LVL 2

Expert Comment

by:kinkajou
Comment Utility
That will explain why I couldn't find an API function to get teh subnet mask.
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 86

Expert Comment

by:jkr
Comment Utility
The 'inofficial' location of the subnet mask is HKLM\System\CurrentControlSet\Services\<Network Adapter Name>\Parameters\Tcpip
0
 
LVL 2

Expert Comment

by:kinkajou
Comment Utility
Cool, thanks. How does one go about getting the <Network Adapter Name>? Is there an API call or say a device look-up?
0
 
LVL 86

Expert Comment

by:jkr
Comment Utility
See 'HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Linkage\Route' (binary data). Only valid if 'LanmanWorkstation' is listed first in 'HKLM\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order', alter it if not.
0
 

Author Comment

by:ames
Comment Utility
There could be multiple network adapters and hence many subnet masks. I used ipconfig or winipcfg. Thanks.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now